bartender.schedulers.abstract#

Exceptions#

JobSubmissionError

Error during job submission.

Classes#

JobDescription

Description for a job.

AbstractScheduler

Abstract scheduler.

Module Contents#

class bartender.schedulers.abstract.JobDescription#

Bases: pydantic.BaseModel

Description for a job.

job_dir: pathlib.Path#
command: str#
application: str = ''#
submitter: str = ''#
exception bartender.schedulers.abstract.JobSubmissionError#

Bases: Exception

Error during job submission.

class bartender.schedulers.abstract.AbstractScheduler#

Bases: abc.ABC

Abstract scheduler.

abstract close() None#
Async:

Return type:

None

Cancel all runnning jobs and make scheduler unable to work.

abstract submit(description: JobDescription) str#
Async:

Parameters:

description (JobDescription) –

Return type:

str

Submit a job description for running.

Parameters:

description (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

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

Parameters:

job_id (str) –

Return type:

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 states(job_ids: list[str]) list[bartender.db.models.job_model.State]#

Get state of jobs.

Once a job is completed, then scheduler can forget job.

Parameters:

job_ids (list[str]) – Identifiers of jobs.

Returns:

States of jobs.

Return type:

list[bartender.db.models.job_model.State]

abstract cancel(job_id: str) None#
Async:

Parameters:

job_id (str) –

Return type:

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 logs(job_id: str, job_dir: pathlib.Path) Tuple[str, str]#

Get stdout and stderr of a job.

If job has not completed, then will raise an exception. If job completed, then stdout,txt and stderr.txt are read from job_dir.

Parameters:
  • job_id (str) – Identifier of job.

  • job_dir (pathlib.Path) – Directory where stdout.txt and stderr.txt files of job are stored.

Returns:

Tuple of stdout and stderr.

Return type:

Tuple[str, str]

async __aenter__() AbstractScheduler#
Return type:

AbstractScheduler

async __aexit__(exc_type: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) None#
Parameters:
Return type:

None