API for inspecting workers.
This class provides proxy for accessing Inspect API of workers. The API is
defined in :py:mod:celery.worker.control
Attributes
| Attribute | Type | Description |
|---|
| app | Celery app = null | The Celery application instance used to dispatch control commands to workers. |
| registered_tasks | method | Alias for the registered method, used to retrieve all tasks currently registered with the workers. |
Constructor
Signature
def Inspect(
destination: list|str = null,
timeout: float = 1.0,
callback: callable = null,
connection: kombu.Connection = null,
app: [Celery](../base/celery.md?sid=celery_app_base_celery) = null,
limit: int = null,
pattern: str = null,
matcher: str = null
)
Parameters
| Name | Type | Description |
|---|
| destination | `list | str` = null |
| timeout | float = 1.0 | Timeout in seconds for waiting for replies. |
| callback | callable = null | Callback to be called for each reply received. |
| connection | kombu.Connection = null | Custom connection to use for the broadcast. |
| app | [Celery](../base/celery.md?sid=celery_app_base_celery) = null | The Celery app instance to use. |
| limit | int = null | Limit the number of replies to wait for. |
| pattern | str = null | A pattern to match node names against. |
| matcher | str = null | The matching algorithm to use (e.g., glob or re). |
Methods
report()
@classmethod
def report() - > object
Return human readable report for each worker.
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: {'ok': REPORT_STRING}}. |
clock()
@classmethod
def clock() - > object
Get the Clock value on workers.
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: CLOCK_VALUE}. |
active()
@classmethod
def active(
safe: boolean = null
) - > object
Return list of tasks currently executed by workers.
Parameters
| Name | Type | Description |
|---|
| safe | boolean = null | Set to True to disable deserialization. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: [TASK_INFO,...]}. |
scheduled()
@classmethod
def scheduled(
safe: boolean = null
) - > object
Return list of scheduled tasks with details.
Parameters
| Name | Type | Description |
|---|
| safe | boolean = null | Flag to control safe deserialization of task data. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: [TASK_SCHEDULED_INFO,...]}. |
reserved()
@classmethod
def reserved(
safe: boolean = null
) - > object
Return list of currently reserved tasks, not including scheduled/active.
Parameters
| Name | Type | Description |
|---|
| safe | boolean = null | Flag to control safe deserialization of task data. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: [TASK_INFO,...]}. |
stats()
@classmethod
def stats() - > object
Return statistics of worker.
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: STAT_INFO} containing broker, uptime, and resource usage data. |
revoked()
@classmethod
def revoked() - > object
Return list of revoked tasks.
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: [TASK_ID, ...]}. |
registered()
@classmethod
def registered(
*taskinfoitems: string
) - > object
Return all registered tasks per worker.
Parameters
| Name | Type | Description |
|---|
| *taskinfoitems | string | List of Task attributes to include in the response for each task. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: [TASK1_INFO, ...]}. |
ping()
@classmethod
def ping(
destination: array = null
) - > object
Ping all (or specific) workers.
Parameters
| Name | Type | Description |
|---|
| destination | array = null | If set, a list of the hosts to send the command to, when empty broadcast to all workers. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: {'ok': 'pong'}}. |
active_queues()
@classmethod
def active_queues() - > object
Return information about queues from which worker consumes tasks.
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: [QUEUE_INFO, QUEUE_INFO,...]}. |
query_task()
@classmethod
def query_task(
*ids: string
) - > object
Return detail of tasks currently executed by workers.
Parameters
| Name | Type | Description |
|---|
| *ids | string | IDs of tasks to be queried. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: {TASK_ID: [STATE, TASK_INFO]}}. |
conf()
@classmethod
def conf(
with_defaults: boolean = false
) - > object
Return configuration of each worker.
Parameters
| Name | Type | Description |
|---|
| with_defaults | boolean = false | if set to True, method returns also configuration options with default values. |
Returns
| Type | Description |
|---|
object | Dictionary {HOSTNAME: WORKER_CONFIGURATION}. |
hello()
@classmethod
def hello(
from_node: string,
revoked: object = null
) - > object
Sends a hello greeting to workers to identify the current node and optionally synchronize revoked tasks.
Parameters
| Name | Type | Description |
|---|
| from_node | string | The name of the node sending the greeting. |
| revoked | object = null | Optional list of revoked tasks to synchronize with the workers. |
Returns
| Type | Description |
|---|
object | The response from the workers acknowledging the greeting. |
memsample()
@classmethod
def memsample() - > object
Return sample current RSS memory usage.
Returns
| Type | Description |
|---|
object | A dictionary containing memory usage samples from workers. |
memdump()
@classmethod
def memdump(
samples: integer = 10
) - > object
Dump statistics of previous memsample requests.
Parameters
| Name | Type | Description |
|---|
| samples | integer = 10 | The number of previous samples to include in the dump. |
Returns
| Type | Description |
|---|
object | A dictionary containing the history of memory samples. |
objgraph()
@classmethod
def objgraph(
type: string = Request,
n: integer = 200,
max_depth: integer = 10
) - > object
Create graph of uncollected objects (memory-leak debugging).
Parameters
| Name | Type | Description |
|---|
| type | string = Request | Name of object to graph. |
| n | integer = 200 | Max number of objects to graph. |
| max_depth | integer = 10 | Traverse at most n levels deep. |
Returns
| Type | Description |
|---|
object | Dictionary {'filename': FILENAME} |