nvflare.apis.job_def module

class Job(job_id: str, resource_spec: Dict[str, Dict], deploy_map: Dict[str, List[str]], meta, min_sites: int = 1, required_sites: Optional[List[str]] = None)[source]

Bases: object

Job object containing the job metadata.

Parameters
  • job_id – Job ID

  • resource_spec – Resource specification with information on the resources of each client

  • deploy_map – Deploy map specifying each app and the sites that it should be deployed to

  • meta – full contents of the persisted metadata for the job for persistent storage

  • min_sites (int) – minimum number of sites

  • required_sites – A list of required site names

get_application(app_name, fl_ctx: FLContext) bytes[source]

Get the application content in bytes for the specified participant.

get_application_name(participant)[source]

Get the application name for the specified participant.

get_deployment() Dict[str, List[str]][source]

Returns the deployment configuration.

"deploy_map": {
    "hello-numpy-sag-server": [
      "server"
    ],
    "hello-numpy-sag-client": [
      "client1",
      "client2"
    ],
    "hello-numpy-sag-client3": [
      "client3"
    ]
  },
Returns

Contents of deploy_map as a dictionary of strings of app names with their corresponding sites

get_resource_requirements()[source]

Returns app resource requirements.

Returns

resource}

Return type

A dict of {site_name

class JobDataKey(value)[source]

Bases: str, Enum

An enumeration.

DATA = 'data'
JOB_DATA = 'job_data_'
META = 'meta'
WORKSPACE_DATA = 'workspace_data_'
class JobMetaKey(value)[source]

Bases: str, Enum

An enumeration.

APPROVALS = 'approvals'
CONTENT_LOCATION = 'content_location'
DEPLOY_MAP = 'deploy_map'
DURATION = 'duration'
JOB_FOLDER_NAME = 'job_folder_name'
JOB_ID = 'job_id'
JOB_NAME = 'name'
MANDATORY_CLIENTS = 'mandatory_clients'
MIN_CLIENTS = 'min_clients'
RESOURCE_SPEC = 'resource_spec'
RESULT_LOCATION = 'result_location'
START_TIME = 'start_time'
STATUS = 'status'
SUBMIT_TIME = 'submit_time'
SUBMIT_TIME_ISO = 'submit_time_iso'
class RunStatus(value)[source]

Bases: str, Enum

An enumeration.

APPROVED = 'APPROVED'
DISPATCHED = 'DISPATCHED'
FAILED_TO_RUN = 'FAILED_TO_RUN'
FINISHED_ABORTED = 'FINISHED:ABORTED'
FINISHED_COMPLETED = 'FINISHED:COMPLETED'
FINISHED_EXECUTION_EXCEPTION = 'FINISHED:EXECUTION_EXCEPTION'
RUNNING = 'RUNNING'
SUBMITTED = 'SUBMITTED'
job_from_meta(meta: dict) Job[source]

Converts information in meta into a Job object.

Parameters

meta – dict of meta information

Returns

A Job object.