MCPcopy Create free account
hub / github.com/celery/celery / test_query_task

Method test_query_task

t/integration/test_inspect.py:160–192  ·  view source on GitHub ↗

Task that does not exist or is finished

(self, inspect)

Source from the content-addressed store, hash-verified

158
159 @flaky
160 def test_query_task(self, inspect):
161 """Task that does not exist or is finished"""
162 ret = inspect.query_task('d08b257e-a7f1-4b92-9fea-be911441cb2a')
163 assert len(ret) == 1
164 assert ret[NODENAME] == {}
165
166 # Task in progress
167 res = sleeping.delay(5)
168 sleep(1)
169 ret = inspect.query_task(res.task_id)
170 assert len(ret) == 1
171 assert ret[NODENAME] == {
172 res.task_id: [
173 'active', {
174 'id': res.task_id,
175 'name': 't.integration.tasks.sleeping',
176 'args': [5],
177 'kwargs': {},
178 'type': 't.integration.tasks.sleeping',
179 'hostname': NODENAME,
180 'time_start': ANY,
181 'acknowledged': True,
182 'delivery_info': {
183 'exchange': '',
184 'routing_key': 'celery',
185 'priority': 0,
186 'redelivered': False
187 },
188 # worker is running in the same process as separate thread
189 'worker_pid': ANY
190 }
191 ]
192 }
193
194 @flaky
195 def test_stats(self, inspect):

Callers

nothing calls this directly

Calls 2

query_taskMethod · 0.80
delayMethod · 0.45

Tested by

no test coverage detected