This document describes an older version of Celery (2.1). For the latest stable version please go here.

Remote Management of Workers - celery.task.control

celery.task.control.broadcast(*args, **kwargs)

Broadcast a control command to the celery workers.

Parameters:
  • command – Name of command to send.
  • arguments – Keyword arguments for the command.
  • destination – If set, a list of the hosts to send the command to, when empty broadcast to all workers.
  • connection – Custom broker connection to use, if not set, a connection will be established automatically.
  • connect_timeout – Timeout for new connection if a custom connection is not provided.
  • reply – Wait for and return the reply.
  • timeout – Timeout in seconds to wait for the reply.
  • limit – Limit number of replies.
  • callback – Callback called immediately for each reply received.
celery.task.control.discard_all(*args, **kwargs)

Discard all waiting tasks.

This will ignore all tasks waiting for execution, and they will be deleted from the messaging server.

Returns:the number of tasks discarded.
celery.task.control.flatten_reply(reply)
class celery.task.control.inspect(destination=None, timeout=1, callback=None)
active(safe=False)
add_consumer(queue, exchange=None, exchange_type='direct', routing_key=None, **options)
cancel_consumer(queue, **kwargs)
disable_events()
enable_events()
ping()
registered_tasks()
reserved(safe=False)
revoked()
scheduled(safe=False)
stats()
celery.task.control.ping(destination=None, timeout=1, **kwargs)

Ping workers.

Returns answer from alive workers.

Parameters:
  • destination – If set, a list of the hosts to send the command to, when empty broadcast to all workers.
  • connection – Custom broker connection to use, if not set, a connection will be established automatically.
  • connect_timeout – Timeout for new connection if a custom connection is not provided.
  • reply – Wait for and return the reply.
  • timeout – Timeout in seconds to wait for the reply.
  • limit – Limit number of replies.
celery.task.control.rate_limit(task_name, rate_limit, destination=None, **kwargs)

Set rate limit for task by type.

Parameters:
  • task_name – Type of task to change rate limit for.
  • rate_limit – The rate limit as tasks per second, or a rate limit string ("100/m", etc. see celery.task.base.Task.rate_limit for more information).
  • destination – If set, a list of the hosts to send the command to, when empty broadcast to all workers.
  • connection – Custom broker connection to use, if not set, a connection will be established automatically.
  • connect_timeout – Timeout for new connection if a custom connection is not provided.
  • reply – Wait for and return the reply.
  • timeout – Timeout in seconds to wait for the reply.
  • limit – Limit number of replies.
celery.task.control.revoke(task_id, destination=None, **kwargs)

Revoke a task by id.

If a task is revoked, the workers will ignore the task and not execute it after all.

Parameters:
  • task_id – Id of the task to revoke.
  • destination – If set, a list of the hosts to send the command to, when empty broadcast to all workers.
  • connection – Custom broker connection to use, if not set, a connection will be established automatically.
  • connect_timeout – Timeout for new connection if a custom connection is not provided.
  • reply – Wait for and return the reply.
  • timeout – Timeout in seconds to wait for the reply.
  • limit – Limit number of replies.

Previous topic

Configuration - celery.conf

Next topic

HTTP Callback Tasks - celery.task.http

This Page