bartender.schedulers.slurm#

Attributes#

Classes#

SlurmSchedulerConfig

Configuration for Slurm scheduler.

SlurmScheduler

Slurm batch scheduler.

Functions#

_map_slurm_state(→ bartender.db.models.job_model.State)

Module Contents#

bartender.schedulers.slurm.logger#
bartender.schedulers.slurm._map_slurm_state(slurm_state: str) bartender.db.models.job_model.State#
Parameters:

slurm_state (str) –

Return type:

bartender.db.models.job_model.State

class bartender.schedulers.slurm.SlurmSchedulerConfig#

Bases: pydantic.BaseModel

Configuration for Slurm scheduler.

Parameters:
  • ssh_config – SSH connection configuration. When set will call SLURM commands on remote system via SSH connection. When not set will call SLURM commands on local system.

  • partition – Partition in which all jobs should be submitted.

  • time – Limit on the total run time of the job.

  • extra_options – Escape hatch to add extra options to job script. The string #SBATCH {extra_options[i]} will be appended to job script.

  • submitter_as_account – Use the submitter as the account to run the job.

type: Literal['slurm'] = 'slurm'#
ssh_config: bartender.shared.ssh.SshConnectConfig | None = None#
partition: str | None = None#
time: str | None = None#
extra_options: list[str] | None = None#
submitter_as_account: bool | None = False#
class bartender.schedulers.slurm.SlurmScheduler(config: SlurmSchedulerConfig)#

Bases: bartender.schedulers.abstract.AbstractScheduler

Slurm batch scheduler.

Parameters:

config (SlurmSchedulerConfig) –

runner: bartender.schedulers.runner.CommandRunner#
ssh_config#
partition#
time#
submitter_as_account#
async submit(description: bartender.schedulers.abstract.JobDescription) str#

Submit a job description for running.

Parameters:

description (bartender.schedulers.abstract.JobDescription) – Description for a job.

Returns:

Identifier that can be used later to interact with job.

Raises:

JobSubmissionError – If job submission failed.

Return type:

str

async state(job_id: str) bartender.db.models.job_model.State#

Get state of a job.

Once job is completed, then scheduler can forget job.

Parameters:

job_id (str) – Identifier of job.

Returns:

State of job.

Return type:

bartender.db.models.job_model.State

async cancel(job_id: str) None#

Cancel a queued or running job.

Once a queued job is cancelled, then the scheduler can forget job.

Parameters:

job_id (str) – Identifier of job.

Return type:

None

async close() None#

Cancel all runnning jobs and make scheduler unable to work.

Return type:

None

__eq__(other: object) bool#
Parameters:

other (object) –

Return type:

bool

__repr__() str#
Return type:

str

async _state_from_accounting(job_id: str) str#
Parameters:

job_id (str) –

Return type:

str

_submit_script(description: bartender.schedulers.abstract.JobDescription) str#
Parameters:

description (bartender.schedulers.abstract.JobDescription) –

Return type:

str