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: List[str] | None = 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'
CLONED_FROM = 'cloned_from'
CONTENT_LOCATION = 'content_location'
CUSTOM_PROPS = 'custom_props'
DATA_STORAGE_FORMAT = 'data_storage_format'
DEPLOY_MAP = 'deploy_map'
DURATION = 'duration'
FROM_HUB_SITE = 'from_hub_site'
JOB_DEPLOY_DETAIL = 'job_deploy_detail'
JOB_FOLDER_NAME = 'job_folder_name'
JOB_ID = 'job_id'
JOB_NAME = 'name'
LAST_SCHEDULE_TIME = 'last_schedule_time'
MANDATORY_CLIENTS = 'mandatory_clients'
MIN_CLIENTS = 'min_clients'
RESOURCE_SPEC = 'resource_spec'
RESULT_LOCATION = 'result_location'
SCHEDULE_COUNT = 'schedule_count'
SCHEDULE_HISTORY = 'schedule_history'
SCOPE = 'scope'
START_TIME = 'start_time'
STATS_POOL_CONFIG = 'stats_pool_config'
STATUS = 'status'
SUBMITTER_NAME = 'submitter_name'
SUBMITTER_ORG = 'submitter_org'
SUBMITTER_ROLE = 'submitter_role'
SUBMIT_TIME = 'submit_time'
SUBMIT_TIME_ISO = 'submit_time_iso'
class RunStatus(value)[source]

Bases: str, Enum

An enumeration.

ABANDONED = 'FINISHED:ABANDONED'
APPROVED = 'APPROVED'
DISPATCHED = 'DISPATCHED'
FAILED_TO_RUN = 'FINISHED:FAILED_TO_RUN'
FINISHED_ABNORMAL = 'FINISHED:ABNORMAL'
FINISHED_ABORTED = 'FINISHED:ABORTED'
FINISHED_CANT_SCHEDULE = 'FINISHED:CAN_NOT_SCHEDULE'
FINISHED_COMPLETED = 'FINISHED:COMPLETED'
FINISHED_EXECUTION_EXCEPTION = 'FINISHED:EXECUTION_EXCEPTION'
RUNNING = 'RUNNING'
SUBMITTED = 'SUBMITTED'
class TopDir[source]

Bases: object

JOB = 'job'
WORKSPACE = 'workspace'
get_custom_prop(meta: dict, prop_key: str, default=None)[source]
get_custom_props(meta: dict, default=None)[source]
is_valid_job_id(jid: str) bool[source]
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.

new_job_id() str[source]