backend.api.jobs

Contains the router for handling jobs.

Attributes

Functions

get_jobs(→ backend.api.models.schemas.job_models.JobStatus)

Fetches the status of a job via its ID.

verify_correct_job_module(job_id, request, module)

Verifies if a job belongs to the module.

Module Contents

backend.api.jobs.router
async backend.api.jobs.get_jobs(job_id: str, request: fastapi.Request) backend.api.models.schemas.job_models.JobStatus

Fetches the status of a job via its ID.

Parameters:
  • job_id – The ID of the job to be fetched.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

Raises:
  • HTTPException – If the job with the given ID is not found in the

  • application state.

Returns:

The status of the job as a JobStatus object.

backend.api.jobs.verify_correct_job_module(job_id: str, request: fastapi.Request, module: str)

Verifies if a job belongs to the module.

Helper funciton used for the request of job states.

Parameters:
  • job_id – The ID of the job to be fetched.

  • request – The FastAPI request object. This is used to access the application state via request.app.state.

  • module – The name of the module that the job is checked against

Raises:

HTTPException – If the job with the given ID does not belong to the module