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

Method test_query_task

t/unit/worker/test_control.py:1040–1065  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1038 _import.assert_not_called()
1039
1040 def test_query_task(self):
1041 consumer = Consumer(self.app)
1042 consumer.controller = _WC(app=self.app)
1043 consumer.controller.consumer = consumer
1044 panel = self.create_panel(consumer=consumer)
1045 panel.app = self.app
1046 req1 = Request(
1047 self.TaskMessage(self.mytask.name, args=(2, 2)),
1048 app=self.app,
1049 )
1050 worker_state.task_reserved(req1)
1051 try:
1052 assert not panel.handle('query_task', {'ids': {'1daa'}})
1053 ret = panel.handle('query_task', {'ids': {req1.id}})
1054 assert req1.id in ret
1055 assert ret[req1.id][0] == 'reserved'
1056 worker_state.active_requests.add(req1)
1057 try:
1058 ret = panel.handle('query_task', {'ids': {req1.id}})
1059 assert ret[req1.id][0] == 'active'
1060 finally:
1061 worker_state.active_requests.clear()
1062 ret = panel.handle('query_task', {'ids': {req1.id}})
1063 assert ret[req1.id][0] == 'reserved'
1064 finally:
1065 worker_state.reserved_requests.clear()
1066
1067 def test_query_task_scheduled(self):
1068 # Regression test for #5321: a task with an ETA/countdown that

Callers

nothing calls this directly

Calls 6

create_panelMethod · 0.95
RequestClass · 0.90
ConsumerClass · 0.70
handleMethod · 0.45
addMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected