bartender.db.dao.job_dao#

Attributes#

Classes#

JobDAO

Class for accessing job table.

Module Contents#

class bartender.db.dao.job_dao.JobDAO(session: bartender.db.dependencies.CurrentSession)#

Class for accessing job table.

Parameters:

session (bartender.db.dependencies.CurrentSession) –

session#
async create_job(name: str | None, application: str, submitter: str, updated_on: datetime.datetime | None = None, created_on: datetime.datetime | None = None) int | None#

Add single job to session.

Parameters:
  • name (Optional[str]) – name of a job.

  • application (str) – name of application to run job for.

  • submitter (str) – User who submitted the job.

  • updated_on (Optional[datetime.datetime]) – Datetime when job was last updated.

  • created_on (Optional[datetime.datetime]) – Datetime when job was created.

Returns:

id of a job.

Return type:

Optional[int]

async get_all_jobs(limit: int, offset: int, user: str) list[bartender.db.models.job_model.Job]#

Get all job models of user with limit/offset pagination.

Parameters:
  • limit (int) – limit of jobs.

  • offset (int) – offset of jobs.

  • user (str) – Which user to get jobs from.

Returns:

stream of jobs.

Return type:

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

async get_job(jobid: int, user: str) bartender.db.models.job_model.Job#

Get specific job model.

Parameters:
  • jobid (int) – name of job instance.

  • user (str) – Which user to get jobs from.

Returns:

job model.

Return type:

bartender.db.models.job_model.Job

async update_job_state(jobid: int, state: bartender.db.models.job_model.State) None#

Update state of a job.

Parameters:
  • jobid (int) – name of job instance.

  • state (bartender.db.models.job_model.State) – new state of job instance.

Return type:

None

async update_internal_job_id(jobid: int, internal_job_id: str, destination: str) None#

Update internal id and destination of a job.

Parameters:
  • jobid (int) – name of job instance.

  • internal_job_id (str) – new internal job id of job instance.

  • destination (str) – To which scheduler/filesystem the job was submitted.

Return type:

None

async set_job_name(jobid: int, user: str, name: str) None#

Set name of a job.

Parameters:
  • jobid (int) – name of job instance.

  • user (str) – Which user to get jobs from.

  • name (str) – new name of job instance.

Raises:

IndexError – if job was not found or user is not the owner.

Return type:

None

async delete_job(jobid: int, user: str) None#

Delete job from database.

Parameters:
  • jobid (int) – name of job instance.

  • user (str) – Which user wants to delete the job.

Raises:

IndexError – if job was not found or user is not the owner.

Return type:

None

bartender.db.dao.job_dao.CurrentJobDAO#