Skip to content

Commit

Permalink
Commands: Adds inspect.query_task command
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Jun 13, 2016
1 parent b0bb412 commit 99b8339
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
20 changes: 12 additions & 8 deletions celery/bin/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,18 +646,19 @@ class inspect(_RemoteControl):
choices = {
'active': (1.0, 'dump active tasks (being processed)'),
'active_queues': (1.0, 'dump queues being consumed from'),
'scheduled': (1.0, 'dump scheduled tasks (eta/countdown/retry)'),
'reserved': (1.0, 'dump reserved tasks (waiting to be processed)'),
'stats': (1.0, 'dump worker statistics'),
'revoked': (1.0, 'dump of revoked task ids'),
'registered': (1.0, 'dump of registered tasks'),
'ping': (0.2, 'ping worker(s)'),
'clock': (1.0, 'get value of logical clock'),
'conf': (1.0, 'dump worker configuration'),
'report': (1.0, 'get bugreport info'),
'memsample': (1.0, 'sample memory (requires psutil)'),
'memdump': (1.0, 'dump memory samples (requires psutil)'),
'memsample': (1.0, 'sample memory (requires psutil)'),
'objgraph': (60.0, 'create object graph (requires objgraph)'),
'ping': (0.2, 'ping worker(s)'),
'query_task': (1.0, 'query for task information by id'),
'reserved': (1.0, 'dump reserved tasks (waiting to be processed)'),
'scheduled': (1.0, 'dump scheduled tasks (eta/countdown/retry)'),
'stats': (1.0, 'dump worker statistics'),
'registered': (1.0, 'dump of registered tasks'),
'report': (1.0, 'get bugreport info'),
'revoked': (1.0, 'dump of revoked task ids'),
}

def call(self, method, *args, **options):
Expand All @@ -670,6 +671,9 @@ def objgraph(self, type_='Request', *args, **kwargs):
def conf(self, with_defaults=False, *args, **kwargs):
return self.call('conf', with_defaults, **kwargs)

def query_task(self, *ids, **options):
return self.call('query_task', ids, **options)


class control(_RemoteControl):
"""Workers remote control.
Expand Down
15 changes: 15 additions & 0 deletions docs/userguide/monitoring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@ Commands
$ celery -A proj inspect stats
* **inspect query_task**: Show information about task(s) by id.

Any worker having a task in this set of ids reserved/active will respond
with status and information.

.. code-block:: console
$ celery -A proj inspect query_task e9f6c8f0-fec9-4ae8-a8c6-cf8c8451d4f8
You can also query for information about multiple tasks:

.. code-block:: console
$ celery -A proj inspect query_task id1 id2 ... idN
* **control enable_events**: Enable events

.. code-block:: console
Expand Down

0 comments on commit 99b8339

Please sign in to comment.