florist.api.routes.server.job module¶
FastAPI routes for the job.
- async change_job_status(job_id, status, request)[source]¶
Change job job_id to specified status.
- Parameters:
- Return type:
JSONResponse
- Returns:
(JSONResponse) If successful, returns 200. If not successful, returns response with status code 400 and body: {“error”: <error message>}
- async list_jobs_with_status(status, request)[source]¶
List jobs with specified status.
Fetches list of Job with max length MAX_RECORDS_TO_FETCH.
- Parameters:
status (
JobStatus
) – (JobStatus) The status of jobs to query the Job DB for.request (
Request
) – (fastapi.Request) the FastAPI request object.
- Return type:
- Returns:
(List[Dict[str, Any]]) A list where each entry is a dictionary with the attributes of a Job instance with the specified status.
- async new_job(request, job=Body(Ellipsis))[source]¶
Create a new training job.
If calling from the REST API, it will receive the job attributes as the Request Body in raw/JSON format. See florist.api.db.entities.Job to check the list of attributes and their requirements.
- Parameters:
request (
Request
) – (fastapi.Request) the FastAPI request object.job (
Job
) – (Job) The Job instance to be saved in the database.
- Return type:
- Returns:
(Job) The job that has been saved in the database.
- Raises:
(HTTPException) status 400 if job.server_info is not None and cannot be parsed into JSON.