nvflare.app_opt.job_launcher.docker_launcher module

class ClientDockerJobLauncher(mount_path: str = '/workspace', network: str = 'nvflare-network', timeout=None)[source]

Bases: DockerJobLauncher

Init 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.

get_command(job_meta, fl_ctx) -> (<class 'str'>, <class 'str'>)[source]

To generate the command to launcher the job in sub-process

Parameters:
  • fl_ctx – FLContext

  • job_meta – job launcher data

Returns:

(container name, launch command)

class DOCKER_STATE[source]

Bases: object

CREATED = 'created'
DEAD = 'dead'
EXITED = 'exited'
PAUSED = 'paused'
RESTARTING = 'restarting'
RUNNING = 'running'
class DockerJobHandle(container, timeout=None)[source]

Bases: JobHandleSpec

enter_states(job_states_to_enter: list, timeout=None)[source]
poll()[source]

To get the return code of the job run.

Returns: return_code

terminate()[source]

To terminate the job run.

Returns: the job run return code.

wait()[source]

To wait until the job run complete.

Returns: returns until the job run complete.

class DockerJobLauncher(mount_path: str = '/workspace', network: str = 'nvflare-network', timeout=None)[source]

Bases: JobLauncherSpec

Init 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_command(job_meta, fl_ctx) -> (<class 'str'>, <class 'str'>)[source]

To generate the command to launcher the job in sub-process

Parameters:
  • fl_ctx – FLContext

  • job_meta – job launcher data

Returns:

(container name, launch command)

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: boolean to indicates the job launch success or fail.

class ServerDockerJobLauncher(mount_path: str = '/workspace', network: str = 'nvflare-network', timeout=None)[source]

Bases: DockerJobLauncher

Init 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.

get_command(job_meta, fl_ctx) -> (<class 'str'>, <class 'str'>)[source]

To generate the command to launcher the job in sub-process

Parameters:
  • fl_ctx – FLContext

  • job_meta – job launcher data

Returns:

(container name, launch command)