p1-taskqueue 0.1.30__tar.gz → 0.1.31__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/PKG-INFO +1 -1
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/pyproject.toml +1 -1
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/p1_taskqueue.egg-info/PKG-INFO +1 -1
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/celery_app.py +2 -3
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/tests/test_celery_app.py +19 -22
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/README.md +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/setup.cfg +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/p1_taskqueue.egg-info/SOURCES.txt +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/p1_taskqueue.egg-info/dependency_links.txt +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/p1_taskqueue.egg-info/requires.txt +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/p1_taskqueue.egg-info/top_level.txt +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/__init__.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/apps.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/cmanager.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/libs/__init__.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/libs/helper_test.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/migrations/0001_initial.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/migrations/0002_add_channel_to_taskreconstruction.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/migrations/0003_alter_taskreconstruction_id.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/migrations/0004_add_callable_name_meta_to_taskreconstruction.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/migrations/__init__.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/models.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/src/taskqueue/slack_notifier.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/tests/test_cmanager.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/tests/test_helper_test_functions.py +0 -0
- {p1_taskqueue-0.1.30 → p1_taskqueue-0.1.31}/tests/test_test_utils.py +0 -0
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "p1-taskqueue"
|
|
7
7
|
# DO NOT CHANGE THIS VERSION - it gets automatically replaced by CI/CD with the git tag version
|
|
8
|
-
version = "0.1.
|
|
8
|
+
version = "0.1.31"
|
|
9
9
|
description = "A Task Queue Wrapper for Dekoruma Backend"
|
|
10
10
|
authors = [
|
|
11
11
|
{name = "Chalvin", email = "engineering@dekoruma.com"}
|
|
@@ -54,14 +54,13 @@ def create_celery_app():
|
|
|
54
54
|
'broker_pool_limit': 2,
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
setup_queues(app, settings, celery_config)
|
|
58
57
|
app.conf.update(celery_config)
|
|
59
58
|
app.autodiscover_tasks(['taskqueue'])
|
|
60
59
|
|
|
61
60
|
return app
|
|
62
61
|
|
|
63
62
|
|
|
64
|
-
def setup_queues(app, settings
|
|
63
|
+
def setup_queues(app, settings):
|
|
65
64
|
app_name = getattr(settings, 'TASKQUEUE_APP_NAME', 'taskqueue')
|
|
66
65
|
queue_names = getattr(settings, 'TASKQUEUE_QUEUES',
|
|
67
66
|
['default', 'high', 'low'])
|
|
@@ -102,7 +101,7 @@ def setup_queues(app, settings, celery_config):
|
|
|
102
101
|
queues.append(dlq)
|
|
103
102
|
logger.info(f"[TaskQueue] DLQ '{dlq_name}' configured")
|
|
104
103
|
|
|
105
|
-
|
|
104
|
+
app.conf.update({
|
|
106
105
|
'task_default_queue': 'default',
|
|
107
106
|
'task_default_exchange': app_name,
|
|
108
107
|
'task_default_exchange_type': 'direct',
|
|
@@ -91,29 +91,28 @@ class TestSetupQueues:
|
|
|
91
91
|
def test_setup_queues_given_valid_settings_expect_queues_configured(self):
|
|
92
92
|
"""Test that setup_queues configures queues and DLQs correctly."""
|
|
93
93
|
mock_app = MagicMock()
|
|
94
|
+
mock_app.conf = {}
|
|
94
95
|
mock_settings = MagicMock()
|
|
95
96
|
mock_settings.TASKQUEUE_APP_NAME = 'testapp'
|
|
96
97
|
mock_settings.TASKQUEUE_QUEUES = ['default', 'high', 'low']
|
|
97
98
|
mock_settings.TASKQUEUE_DLQ_NAME_PREFIX = 'dlq'
|
|
98
99
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
setup_queues(mock_app, mock_settings, celery_config)
|
|
100
|
+
setup_queues(mock_app, mock_settings)
|
|
102
101
|
|
|
103
102
|
# Assertions
|
|
104
|
-
assert
|
|
105
|
-
assert
|
|
106
|
-
assert
|
|
107
|
-
assert len(
|
|
103
|
+
assert mock_app.conf['task_default_queue'] == 'default'
|
|
104
|
+
assert mock_app.conf['task_default_exchange'] == 'testapp'
|
|
105
|
+
assert mock_app.conf['task_default_exchange_type'] == 'direct'
|
|
106
|
+
assert len(mock_app.conf['task_queues']) == 6
|
|
108
107
|
|
|
109
|
-
main_queues = [q for q in
|
|
108
|
+
main_queues = [q for q in mock_app.conf['task_queues']
|
|
110
109
|
if not q.name.startswith('dlq.')]
|
|
111
110
|
assert len(main_queues) == 3
|
|
112
111
|
assert any(q.name == 'default' for q in main_queues)
|
|
113
112
|
assert any(q.name == 'high' for q in main_queues)
|
|
114
113
|
assert any(q.name == 'low' for q in main_queues)
|
|
115
114
|
|
|
116
|
-
dlq_queues = [q for q in
|
|
115
|
+
dlq_queues = [q for q in mock_app.conf['task_queues']
|
|
117
116
|
if q.name.startswith('dlq.')]
|
|
118
117
|
assert len(dlq_queues) == 3
|
|
119
118
|
assert any(q.name == 'dlq.default' for q in dlq_queues)
|
|
@@ -122,40 +121,38 @@ class TestSetupQueues:
|
|
|
122
121
|
|
|
123
122
|
def test_setup_queues_given_missing_settings_expect_defaults_used(self):
|
|
124
123
|
mock_app = MagicMock()
|
|
124
|
+
mock_app.conf = {}
|
|
125
125
|
mock_settings = MagicMock()
|
|
126
126
|
del mock_settings.TASKQUEUE_APP_NAME
|
|
127
127
|
del mock_settings.TASKQUEUE_QUEUES
|
|
128
128
|
del mock_settings.TASKQUEUE_DLQ_NAME_PREFIX
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
setup_queues(mock_app, mock_settings, celery_config)
|
|
130
|
+
setup_queues(mock_app, mock_settings)
|
|
133
131
|
|
|
134
|
-
assert
|
|
135
|
-
assert
|
|
136
|
-
assert
|
|
137
|
-
assert len(
|
|
132
|
+
assert mock_app.conf['task_default_queue'] == 'default'
|
|
133
|
+
assert mock_app.conf['task_default_exchange'] == 'taskqueue'
|
|
134
|
+
assert mock_app.conf['task_default_exchange_type'] == 'direct'
|
|
135
|
+
assert len(mock_app.conf['task_queues']) == 6
|
|
138
136
|
|
|
139
137
|
def test_setup_queues_given_single_queue_expect_correct_configuration(self):
|
|
140
138
|
mock_app = MagicMock()
|
|
139
|
+
mock_app.conf = {}
|
|
141
140
|
mock_settings = MagicMock()
|
|
142
141
|
mock_settings.TASKQUEUE_APP_NAME = 'singleapp'
|
|
143
142
|
mock_settings.TASKQUEUE_QUEUES = ['single']
|
|
144
143
|
mock_settings.TASKQUEUE_DLQ_NAME_PREFIX = 'dead'
|
|
145
144
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
setup_queues(mock_app, mock_settings, celery_config)
|
|
145
|
+
setup_queues(mock_app, mock_settings)
|
|
149
146
|
|
|
150
|
-
assert len(
|
|
147
|
+
assert len(mock_app.conf['task_queues']) == 2
|
|
151
148
|
|
|
152
149
|
main_queue = next(
|
|
153
|
-
q for q in
|
|
150
|
+
q for q in mock_app.conf['task_queues'] if q.name == 'single')
|
|
154
151
|
assert main_queue.queue_arguments['x-dead-letter-exchange'] == 'singleapp.dlx'
|
|
155
152
|
assert main_queue.queue_arguments['x-dead-letter-routing-key'] == 'dead.single'
|
|
156
153
|
|
|
157
154
|
dlq = next(
|
|
158
|
-
q for q in
|
|
155
|
+
q for q in mock_app.conf['task_queues'] if q.name == 'dead.single')
|
|
159
156
|
assert dlq.exchange.name == 'singleapp.dlx'
|
|
160
157
|
|
|
161
158
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|