Skip to content

Commit

Permalink
- Add docstring to facilitate doc generation for `fx workspace docker…
Browse files Browse the repository at this point in the history
…ize` command

- Rebased - 18/Nov/2024
- Updated as per latest code and comments
- Added module level comment
Signed-off-by: Shailesh Pant <[email protected]>
  • Loading branch information
ishaileshpant committed Nov 19, 2024
1 parent a977fb3 commit 2245ae2
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions openfl/interface/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
# SPDX-License-Identifier: Apache-2.0


"""Workspace module."""
"""Workspace module
Module for managing Federated Learning Workspaces.
This module provides a set of commands and functions to create, import, export, and manage
Federated Learning workspaces. It includes functionalities for setting up workspace directories,
creating workspace templates, generating certificates, and packaging workspaces as Docker images.
Commands:
create: Create the workspace.
import: Import a federated learning workspace generated by `fx workspace export`.
certify: Create certificate authority for federation.
export: Export the OpenFL workspace (in current directory) to an archive.
dockerize: Package the current workspace as a Trusted Execution Environment (TEE)-ready Docker image.
"""
import logging
import os
import shutil
Expand Down Expand Up @@ -413,8 +425,26 @@ def export_() -> str:
)
@pass_context
def dockerize_(context, save: bool, rebuild: bool, enclave_key: str, revision: str):
"""Package current workspace as a TEE-ready Docker image."""
"""
Package the current workspace as a Trusted Execution Environment (TEE)-ready Docker image.
This command exports the current workspace, builds an OpenFL base Docker image,
constructs the workspace Docker image, and optionally saves the workspace image as a tarball file.
Steps Performed:
1. Exports the current workspace as an archive.
2. Builds the OpenFL base Docker image using the specified or default revision.
3. Builds the workspace Docker image, incorporating the exported workspace and signing key.
4. Optionally saves the workspace Docker image as a `.tar` file.
Raises:
FileNotFoundError: If the provided enclave key path does not exist.
RuntimeError: If any Docker commands fail during the build or export process.
Notes:
- If no enclave key is provided, a new one is generated using OpenSSL and saved in the workspace.
- The generated image is compatible with TEE environments but can be used outside of TEE if needed.
- Docker BuildKit is utilized for efficient and secure image builds.
"""
# Docker build options
options = []
options.append("--no-cache" if rebuild else "")
Expand Down

0 comments on commit 2245ae2

Please sign in to comment.