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-server": [
      "server"
    ],
    "hello-numpy-client": [
      "client1",
      "client2"
    ],
    "hello-numpy-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'
EDGE_METHOD = 'edge_method'
FROM_HUB_SITE = 'from_hub_site'
JOB_CLIENTS = 'job_clients'
JOB_DEPLOY_DETAIL = 'job_deploy_detail'
JOB_FOLDER_NAME = 'job_folder_name'
JOB_ID = 'job_id'
JOB_LAUNCHER_SPEC = 'launcher_spec'
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'
STUDY = 'study'
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 SubmitRecordKey(value)[source]

Bases: str, Enum

An enumeration.

DELETED_BY = 'deleted_by'
DELETED_TIME = 'deleted_time'
JOB_CONTENT_HASH = 'job_content_hash'
JOB_FOLDER_NAME = 'job_folder_name'
JOB_ID = 'job_id'
JOB_NAME = 'job_name'
SCHEMA_VERSION = 'schema_version'
STATE = 'state'
STUDY = 'study'
SUBMITTER_NAME = 'submitter_name'
SUBMITTER_ORG = 'submitter_org'
SUBMITTER_ROLE = 'submitter_role'
SUBMIT_TIME = 'submit_time'
SUBMIT_TOKEN = 'submit_token'
class SubmitRecordState(value)[source]

Bases: str, Enum

An enumeration.

CREATED = 'created'
CREATING = 'creating'
JOB_DELETED = 'job_deleted'
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]
get_job_meta_study(meta: dict) str[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]