worker.control

Worker remote control command implementations.

Module Contents

Classes

Panel() Global registry of remote control commands.

Functions

ok(value)
nok(value)
control_command(**kwargs)
inspect_command(**kwargs)
report(state) Information about Celery installation for bug reports.
conf(state,with_defaults=False,**kwargs) List configuration.
_wanted_config_key(key)
query_task(state,ids,**kwargs) Query for task information by id.
_find_requests_by_id(ids,get_request=None)
_state_of_task(request,is_active=None,is_reserved=None)
revoke(state,task_id,terminate=False,signal=None,**kwargs) Revoke task by task id (or list of ids).
terminate(state,signal,task_id,**kwargs) Terminate task by task id (or list of ids).
rate_limit(state,task_name,rate_limit,**kwargs) Tell worker(s) to modify the rate limit for a task by type.
time_limit(state,task_name=None,hard=None,soft=None,**kwargs) Tell worker(s) to modify the time limit for task by type.
clock(state,**kwargs) Get current logical clock value.
election(state,id,topic,action=None,**kwargs) Hold election.
enable_events(state) Tell worker(s) to send task-related events.
disable_events(state) Tell worker(s) to stop sending task-related events.
heartbeat(state) Tell worker(s) to send event heartbeat immediately.
hello(state,from_node,revoked=None,**kwargs) Request mingle sync-data.
ping(state,**kwargs) Ping worker(s).
stats(state,**kwargs) Request worker statistics/information.
scheduled(state,**kwargs) List of currently scheduled ETA/countdown tasks.
_iter_schedule_requests(timer)
reserved(state,**kwargs) List of currently reserved tasks, not including scheduled/active.
active(state,**kwargs) List of tasks currently being executed.
revoked(state,**kwargs) List of revoked task-ids.
registered(state,taskinfoitems=None,builtins=False,**kwargs) List of registered tasks.
objgraph(state,num=200,max_depth=10,type=”Request”) Create graph of uncollected objects (memory-leak debugging).
memsample(state,**kwargs) Sample current RSS memory usage.
memdump(state,samples=10,**kwargs) Dump statistics of previous memsample requests.
pool_grow(state,n=1,**kwargs) Grow pool by n processes/threads.
pool_shrink(state,n=1,**kwargs) Shrink pool by n processes/threads.
pool_restart(state,modules=None,reload=False,reloader=None,**kwargs) Restart execution pool.
autoscale(state,max=None,min=None) Modify autoscale settings.
shutdown(state,msg=”Got shutdown from remote”,**kwargs) Shutdown worker(s).
add_consumer(state,queue,exchange=None,exchange_type=None,routing_key=None,**options) Tell worker(s) to consume from task queue by name.
cancel_consumer(state,queue,**_) Tell worker(s) to stop consuming from task queue by name.
active_queues(state) List the task queues a worker is currently consuming from.
ok(value)
nok(value)
class Panel

Global registry of remote control commands.

register(*args, **kwargs)
_register(name=None, alias=None, type="control", visible=True, default_timeout=1.0, help=None, signature=None, args=None, variadic=None)
control_command(**kwargs)
inspect_command(**kwargs)
report(state)

Information about Celery installation for bug reports.

conf(state, with_defaults=False, **kwargs)

List configuration.

_wanted_config_key(key)
query_task(state, ids, **kwargs)

Query for task information by id.

_find_requests_by_id(ids, get_request=None)
_state_of_task(request, is_active=None, is_reserved=None)
revoke(state, task_id, terminate=False, signal=None, **kwargs)

Revoke task by task id (or list of ids).

Keyword Arguments:
terminate (bool): Also terminate the process if the task is active. signal (str): Name of signal to use for terminate (e.g., KILL).
terminate(state, signal, task_id, **kwargs)

Terminate task by task id (or list of ids).

rate_limit(state, task_name, rate_limit, **kwargs)

Tell worker(s) to modify the rate limit for a task by type.

See Also:
celery.task.base.Task.rate_limit.
Arguments:
task_name (str): Type of task to set rate limit for. rate_limit (int, str): New rate limit.
time_limit(state, task_name=None, hard=None, soft=None, **kwargs)

Tell worker(s) to modify the time limit for task by type.

Arguments:
task_name (str): Name of task to change. hard (float): Hard time limit. soft (float): Soft time limit.
clock(state, **kwargs)

Get current logical clock value.

election(state, id, topic, action=None, **kwargs)

Hold election.

Arguments:
id (str): Unique election id. topic (str): Election topic. action (str): Action to take for elected actor.
enable_events(state)

Tell worker(s) to send task-related events.

disable_events(state)

Tell worker(s) to stop sending task-related events.

heartbeat(state)

Tell worker(s) to send event heartbeat immediately.

hello(state, from_node, revoked=None, **kwargs)

Request mingle sync-data.

ping(state, **kwargs)

Ping worker(s).

stats(state, **kwargs)

Request worker statistics/information.

scheduled(state, **kwargs)

List of currently scheduled ETA/countdown tasks.

_iter_schedule_requests(timer)
reserved(state, **kwargs)

List of currently reserved tasks, not including scheduled/active.

active(state, **kwargs)

List of tasks currently being executed.

revoked(state, **kwargs)

List of revoked task-ids.

registered(state, taskinfoitems=None, builtins=False, **kwargs)

List of registered tasks.

Arguments:
taskinfoitems (Sequence[str]): List of task attributes to include.
Defaults to exchange,routing_key,rate_limit.

builtins (bool): Also include built-in tasks.

objgraph(state, num=200, max_depth=10, type="Request")

Create graph of uncollected objects (memory-leak debugging).

Arguments:
num (int): Max number of objects to graph. max_depth (int): Traverse at most n levels deep. type (str): Name of object to graph. Default is "Request".
memsample(state, **kwargs)

Sample current RSS memory usage.

memdump(state, samples=10, **kwargs)

Dump statistics of previous memsample requests.

pool_grow(state, n=1, **kwargs)

Grow pool by n processes/threads.

pool_shrink(state, n=1, **kwargs)

Shrink pool by n processes/threads.

pool_restart(state, modules=None, reload=False, reloader=None, **kwargs)

Restart execution pool.

autoscale(state, max=None, min=None)

Modify autoscale settings.

shutdown(state, msg="Got shutdown from remote", **kwargs)

Shutdown worker(s).

add_consumer(state, queue, exchange=None, exchange_type=None, routing_key=None, **options)

Tell worker(s) to consume from task queue by name.

cancel_consumer(state, queue, **_)

Tell worker(s) to stop consuming from task queue by name.

active_queues(state)

List the task queues a worker is currently consuming from.