diff --git a/Makefile b/Makefile index 2b51333045d425728a670cd4284fef0cb0dbdb0a..aa9f5bdb7d3708083b6f1ea8e0715552840bf3ab 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ build: CI_PROJECT_DIR=$(ROOT_DIR) CI_REGISTRY_IMAGE=$(IMAGE_TAG) $(ROOT_DIR)/ci/build.sh worker: - arkindex rqworker -v 2 default high tasks + arkindex rqworker -v 2 default high tasks export test-fixtures: $(eval export PGPASSWORD=devdata) diff --git a/arkindex/documents/export/__init__.py b/arkindex/documents/export/__init__.py index 7e760e08562c5d84a7fbb2748e5ebd58c6eacfc2..33e2c738a1247f7963c74ab970665d1db89c29b6 100644 --- a/arkindex/documents/export/__init__.py +++ b/arkindex/documents/export/__init__.py @@ -118,7 +118,7 @@ def send_email(subject, template_name, corpus_export, **context): logger.error(f"Failed to send email to {corpus_export.user.email}") -@job("high", timeout=settings.RQ_TIMEOUTS["export_corpus"]) +@job("export", timeout=settings.RQ_TIMEOUTS["export_corpus"]) def export_corpus(corpus_export: CorpusExport) -> None: _, db_path = tempfile.mkstemp(suffix=".db") try: diff --git a/arkindex/project/settings.py b/arkindex/project/settings.py index ee1cd960077868fdf019eff6cd76fefba3fe7ff4..dbd5a3b43d7c81c3fd3a7a521f1a312f7372502b 100644 --- a/arkindex/project/settings.py +++ b/arkindex/project/settings.py @@ -348,6 +348,7 @@ RQ_QUEUES = { "default": _rq_queue_conf, "high": _rq_queue_conf, "tasks": _rq_queue_conf, + "export": _rq_queue_conf, } RQ_TIMEOUTS = conf["job_timeouts"] diff --git a/arkindex/users/tests/test_jobs.py b/arkindex/users/tests/test_jobs.py index e008cb2eeb7ab807cac01067ee1fb2b107f1c039..9e4da6d5ca53ddf4fcb45f678e4b747237a56820 100644 --- a/arkindex/users/tests/test_jobs.py +++ b/arkindex/users/tests/test_jobs.py @@ -222,10 +222,12 @@ class TestJobs(FixtureAPITestCase): self.assertEqual(get_queue_mock.call_args_list, [ call("default"), call("high"), + call("export"), ]) # Called once per queue self.assertListEqual(get_queue_mock().fetch_job.call_args_list, [ + call("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), call("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), call("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa") ]) @@ -291,9 +293,11 @@ class TestJobs(FixtureAPITestCase): self.assertEqual(get_queue_mock.call_args_list, [ call("default"), call("high"), + call("export"), ]) self.assertListEqual(get_queue_mock().fetch_job.call_args_list, [ + call("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), call("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), call("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa") ]) diff --git a/docker-compose.yml b/docker-compose.yml index 40e5a91e080811108aae3aa523c64118224e972b..ceed38cfeb90eb17184abd1a168383b51d692bd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: worker: container_name: ark-worker build: . - command: arkindex rqworker-pool --num-workers 2 -v 1 default high tasks + command: arkindex rqworker-pool --num-workers 2 -v 1 default high tasks export depends_on: - db