nvflare.app_opt.job_launcher.k8s_launcher module
- class ClientK8sJobLauncher(config_file_path: str, study_data_pvc_file_path: str, timeout=None, namespace='default', pending_timeout=120, python_path=None, security_context: dict | None = None, ephemeral_storage: str = '1Gi', default_python_path: str | None = None, workspace_mount_path: str = '/var/tmp/nvflare/workspace', image_pull_secrets: list[str] | None = None)[source]
Bases:
K8sJobLauncherInit FLComponent.
The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)
FLComponents have the capability to handle and fire events and contain various methods for logging.
- class JobState(value)[source]
Bases:
EnumAn enumeration.
- RUNNING = 'running'
- STARTING = 'starting'
- SUCCEEDED = 'succeeded'
- TERMINATED = 'terminated'
- UNKNOWN = 'unknown'
- class K8sJobHandle(job_id: str, api_instance, job_config: dict, namespace='default', timeout=None, pending_timeout=120, python_path='/usr/local/bin/python', workspace_transfer: WorkspaceTransferManager | None = None, workspace_job_id: str = '', pod_name: str | None = None)[source]
Bases:
JobHandleSpec
- class K8sJobLauncher(config_file_path: str, study_data_pvc_file_path: str, timeout=None, namespace='default', pending_timeout=120, python_path=None, security_context: dict | None = None, ephemeral_storage: str = '1Gi', default_python_path: str | None = None, workspace_mount_path: str = '/var/tmp/nvflare/workspace', image_pull_secrets: list[str] | None = None)[source]
Bases:
JobLauncherSpecInit FLComponent.
The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)
FLComponents have the capability to handle and fire events and contain various methods for logging.
- abstract get_module_args(job_id, fl_ctx: FLContext)[source]
To get the args to run the launcher
- Parameters:
job_id – run job_id
fl_ctx – FLContext
Returns:
- handle_event(event_type: str, fl_ctx: FLContext)[source]
Handles events.
- Parameters:
event_type (str) – event type fired by workflow.
fl_ctx (FLContext) – FLContext information.
- launch_job(job_meta: dict, fl_ctx: FLContext) JobHandleSpec[source]
To launch a job run.
- Parameters:
job_meta – job metadata
fl_ctx – FLContext
Returns: a JobHandle instance.
- class PodPhase(value)[source]
Bases:
EnumAn enumeration.
- FAILED = 'Failed'
- PENDING = 'Pending'
- RUNNING = 'Running'
- SUCCEEDED = 'Succeeded'
- UNKNOWN = 'Unknown'
- class ServerK8sJobLauncher(config_file_path: str, study_data_pvc_file_path: str, timeout=None, namespace='default', pending_timeout=120, python_path=None, security_context: dict | None = None, ephemeral_storage: str = '1Gi', default_python_path: str | None = None, workspace_mount_path: str = '/var/tmp/nvflare/workspace', image_pull_secrets: list[str] | None = None)[source]
Bases:
K8sJobLauncherInit FLComponent.
The FLComponent is the base class of all FL Components. (executors, controllers, responders, filters, aggregators, and widgets are all FLComponents)
FLComponents have the capability to handle and fire events and contain various methods for logging.
- job_pod_name(job_id: str, site_name: str) str[source]
Build a site-scoped Kubernetes pod name for a FL job.