1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

feat(operations): jobs a request runs

Request jobs (an upload's chunks) run in gunicorn: their kind is admitted
running with the request as its worker, never claimed or recovered by the
worker, cancelled in the request, and asked by every housekeeping pass to
end its jobs that went idle. The panel can follow a job the page just
started. A job a request runs does not wait for the worker, so it does not
raise the worker-unavailable warning on the Jobs page or in the panel.
This commit is contained in:
catborise 2026-10-16 08:52:34 +03:00
parent 41e1fcd4b9
commit f2138e54d8
14 changed files with 224 additions and 17 deletions

View file

@ -49,6 +49,14 @@ class OperationsApiTestCase(TransactionTestCase):
self.client.force_login(self.owner)
self.assertTrue(self.client.get("/api/v1/operations/resource/", {"key": "instance:u2"}).json()["short_operation"])
def test_the_resource_view_marks_a_job_a_request_runs(self):
request_job = jobs.submit("test.request", self.owner, {"uuid": "u2"}, "key-00000002")
self.client.force_login(self.owner)
[job] = self.client.get("/api/v1/operations/resource/", {"key": "instance:u2"}).json()["jobs"]
self.assertEqual((job["id"], job["in_request"]), (str(request_job.pk), True))
# queued: it waits for the worker
self.assertFalse(self.client.get(f"/api/v1/operations/{self.op.pk}/").json()["in_request"])
def test_cancel_through_the_api(self):
self.client.force_login(self.owner)
response = self.client.post(f"/api/v1/operations/{self.op.pk}/cancel/")