nvflare.app_common.job_schedulers.job_scheduler module

class DefaultJobScheduler(max_jobs: int = 1, max_schedule_count: int = 10, min_schedule_interval: float = 10.0, max_schedule_interval: float = 600.0)[source]

Bases: JobSchedulerSpec, FLComponent

Create a DefaultJobScheduler :param max_jobs: max number of concurrent jobs allowed :param max_schedule_count: max number of times to try to schedule a job :param min_schedule_interval: min interval between two schedules :param max_schedule_interval: max interval between two schedules

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.

remove_scheduled_job(job_id: str)[source]
restore_scheduled_job(job_id: str)[source]
schedule_job(job_manager: JobDefManagerSpec, job_candidates: List[Job], fl_ctx: FLContext)[source]

Try to schedule a Job.

Parameters:
  • job_manager – JobDefManager

  • job_candidates – The candidate to choose from.

  • fl_ctx – FLContext.

Returns:

job is the Job that satisfies the criteria of the scheduler. sites_dispatch_info is dict of {site name: DispatchInfo} for the job.

Return type:

A tuple of (job, sites_dispatch_info, failed_jobs, blocked_jobs)