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

Method query_task

celery/app/control.py:342–372  ·  view source on GitHub ↗

Return details of tasks currently scheduled, reserved or executed by workers. Arguments: *ids (str): IDs of tasks to be queried. Returns: Dict: Dictionary ``{HOSTNAME: {TASK_ID: [STATE, TASK_INFO]}}``. Here is the list of ``TASK_INFO`` fields:

(self, *ids)

Source from the content-addressed store, hash-verified

340 return self._request('active_queues')
341
342 def query_task(self, *ids):
343 """Return details of tasks currently scheduled, reserved or executed by workers.
344
345 Arguments:
346 *ids (str): IDs of tasks to be queried.
347
348 Returns:
349 Dict: Dictionary ``{HOSTNAME: {TASK_ID: [STATE, TASK_INFO]}}``.
350
351 Here is the list of ``TASK_INFO`` fields:
352 * ``id`` - ID of the task
353 * ``name`` - Name of the task
354 * ``args`` - Positinal arguments passed to the task
355 * ``kwargs`` - Keyword arguments passed to the task
356 * ``type`` - Type of the task
357 * ``hostname`` - Hostname of the worker processing the task
358 * ``time_start`` - Time of processing start
359 * ``acknowledged`` - True when task was acknowledged to broker
360 * ``delivery_info`` - Dictionary containing delivery information
361 * ``exchange`` - Name of exchange where task was published
362 * ``routing_key`` - Routing key used when task was published
363 * ``priority`` - Priority used when task was published
364 * ``redelivered`` - True if the task was redelivered
365 * ``worker_pid`` - PID of worker processing the task
366
367 """
368 # signature used be unary: query_task(ids=[id1, id2])
369 # we need this to preserve backward compatibility.
370 if len(ids) == 1 and isinstance(ids[0], (list, tuple)):
371 ids = ids[0]
372 return self._request('query_task', ids=ids)
373
374 def conf(self, with_defaults=False):
375 """Return configuration of each worker.

Callers 6

test_query_taskMethod · 0.80
test_query_taskMethod · 0.80
is_scheduledMethod · 0.80
query_tasksMethod · 0.80

Calls 1

_requestMethod · 0.95

Tested by 5

test_query_taskMethod · 0.64
test_query_taskMethod · 0.64
is_scheduledMethod · 0.64