Writing Schedulers

A new scheduler inherits from the sherpa.schedulers.Scheduler class and re-implements its methods submit_job, get_status, and kill_job.

class sherpa.schedulers.Scheduler[source]

The job scheduler gives an API to submit jobs, retrieve statuses of specific jobs, and kill a job.

get_status(job_id)[source]

Obtains the current status of the job.

Parameters:job_id (str) – identifier returned when submitting the job.
Returns:the job-status.
Return type:sherpa.schedulers._JobStatus
kill_job(job_id)[source]

Kills a given job.

Parameters:job_id (str) – identifier returned when submitting the job.
submit_job(command, env={}, job_name='')[source]

Submits a job to the scheduler.

Parameters:
  • command (list[str]) – components to the command to run by the scheduler e.g. ["python", "train.py"]
  • env (dict) – environment variables to pass to the job.
  • job_name (str) – this specifies a name for the job and its output directory.
Returns:

a job ID, used for getting the status or killing the job.

Return type:

str