bartender.schedulers.abstract#
Exceptions#
Error during job submission. |
Classes#
Description for a job. |
|
Abstract scheduler. |
Module Contents#
- class bartender.schedulers.abstract.JobDescription#
Bases:
pydantic.BaseModelDescription for a job.
- job_dir: pathlib.Path#
- exception bartender.schedulers.abstract.JobSubmissionError#
Bases:
ExceptionError during job submission.
- class bartender.schedulers.abstract.AbstractScheduler#
Bases:
abc.ABCAbstract 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:
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:
- 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.
- 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:
- async __aenter__() AbstractScheduler#
- Return type:
- async __aexit__(exc_type: Type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) None#
- Parameters:
exc_type (Optional[Type[BaseException]]) –
exc (Optional[BaseException]) –
tb (Optional[types.TracebackType]) –
- Return type:
None