MockUWSJobRunner¶
- class safir.testing.uws.MockUWSJobRunner(config, arq_queue)¶
Bases:
object
Simulate execution of jobs with a mock queue.
When running the test suite, the arq queue is replaced with a mock queue that doesn’t execute workers. That execution has to be simulated by manually updating state in the mock queue and running the UWS database worker functions that normally would be run automatically by the queue.
This class wraps that functionality in an async context manager. An instance of it is normally provided as a fixture, initialized with the same test objects as the test suite.
- Parameters:
config (
UWSConfig
) – UWS configuration.arq_queue (
MockArqQueue
) – Mock arq queue for testing.
Methods Summary
get_job_metadata
(username, job_id)Get the arq job metadata for a job.
get_job_result
(username, job_id)Get the arq job result for a job.
mark_complete
(username, job_id, results, *)Mark an in progress job as complete.
mark_in_progress
(username, job_id, *[, delay])Mark a queued job in progress.
Methods Documentation
- async get_job_metadata(username, job_id)¶
Get the arq job metadata for a job.
- Parameters:
- Returns:
arq job metadata.
- Return type:
- async get_job_result(username, job_id)¶
Get the arq job result for a job.
- Parameters:
- Returns:
arq job metadata.
- Return type:
- async mark_complete(username, job_id, results, *, delay=None)¶
Mark an in progress job as complete.
- Parameters:
- Returns:
Record of the job.
- Return type:
- async mark_in_progress(username, job_id, *, delay=None)¶
Mark a queued job in progress.