示例#1
0
def check_status(
    task_id: str, queue: Queue = Depends(get_queue)) -> ResponseTaskStatus:
    job = queue.fetch_job(task_id)
    if job is None:
        raise HTTPException(status_code=status.HTTP_404_NOT_FOUND,
                            detail='Task not found')
    return ResponseTaskStatus(id=task_id,
                              status=Status.from_job_status(job.get_status()))
示例#2
0
def test_rq_status_response(input: str, expected: str):
    assert Status.from_job_status(input) == expected