nvflare.apis.job_def_manager_spec module¶
- class JobDefManagerSpec[source]¶
Bases:
FLComponent
,ABC
Job Definition Management API.
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 create(meta: dict, uploaded_content: bytes, fl_ctx: FLContext) Dict[str, Any] [source]¶
Create a new job permanently.
The caller must have validated the content already and created initial meta. Receives bytes of uploaded folder, uploading to permanent store, create unique Job ID (jid) and return meta.
- Parameters
meta – caller-provided meta info
uploaded_content – data of the job definition
fl_ctx (FLContext) – FLContext information
- Returns
A dict containing meta info. Additional meta info are added, especially a unique Job ID (jid) which has been created.
- abstract delete(jid: str, fl_ctx: FLContext)[source]¶
Deletes the specified Job.
- Parameters
jid (str) – Job ID
fl_ctx (FLContext) – FLContext information
- abstract get_all_jobs(fl_ctx: FLContext) List[Job] [source]¶
Gets all Jobs in the system.
- Parameters
fl_ctx (FLContext) – FLContext information
- Returns
A list of all jobs
- abstract get_app(job: Job, app_name: str, fl_ctx: FLContext) bytes [source]¶
Get the contents of the specified app in bytes.
- Parameters
job – Job object
app_name – name of the app to get
fl_ctx (FLContext) – FLContext information
- Returns
Content of the specified app in bytes
- abstract get_apps(job: Job, fl_ctx: FLContext) Dict[str, bytes] [source]¶
Get the all the apps of a Job.
- Parameters
job – Job object
fl_ctx (FLContext) – FLContext information
- Returns
A dictionary of app names with the content of the corresponding app encoded in bytes
- abstract get_content(jid: str, fl_ctx: FLContext) Optional[bytes] [source]¶
Gets the entire uploaded content for a Job.
- Parameters
jid (str) – Job ID
fl_ctx (FLContext) – FLContext information
- Returns
Uploaded content of the job in bytes
- abstract get_job(jid: str, fl_ctx: FLContext) Job [source]¶
Gets the Job object through the job ID.
- Parameters
jid (str) – Job ID
fl_ctx (FLContext) – FLContext information
- Returns
A Job object
- abstract get_job_data(jid: str, fl_ctx: FLContext) dict [source]¶
Gets the entire uploaded content and workspace for a job.
- Parameters
jid (str) – Job ID
fl_ctx (FLContext) – FLContext information
- Returns
a dict to hold the job data and workspace. Format: {
JobDataKey.JOB_DATA.value: stored_data, JobDataKey.WORKSPACE_DATA: workspace_data
}
- abstract get_jobs_by_status(run_status: RunStatus, fl_ctx: FLContext) List[Job] [source]¶
Gets Jobs of a specified status.
- Parameters
run_status (RunStatus) – status to filter for
fl_ctx (FLContext) – FLContext information
- Returns
A list of Jobs of the specified status
- abstract get_jobs_waiting_for_review(reviewer_name: str, fl_ctx: FLContext) List[Job] [source]¶
Gets Jobs waiting for review for the specified user.
- Parameters
reviewer_name (str) – reviewer name
fl_ctx (FLContext) – FLContext information
- Returns
A list of Jobs waiting for review for the specified user.
- abstract save_workspace(jid: str, data: bytes, fl_ctx: FLContext)[source]¶
Save the job workspace to the job storage.
- Parameters
jid (str) – Job ID
data – Job workspace data
fl_ctx (FLContext) – FLContext information
- abstract set_approval(jid: str, reviewer_name: str, approved: bool, note: str, fl_ctx: FLContext) Dict[str, Any] [source]¶
Sets the approval for the specified user for a certain Job.
- Parameters
jid (str) – job id
reviewer_name (str) – reviewer name
approved (bool) – whether job is approved
note (str) – any note message
fl_ctx (FLContext) – FLContext information
- Returns
A dictionary of Job metadata.