This document describes the current stable version of Celery (4.3). For development docs, go here.

celery.bin.celery

The celery umbrella command.

Preload Options

These options are supported by all commands, and usually parsed before command-specific arguments.

-A, --app

app instance to use (e.g., module.attr_name)

-b, --broker

URL to broker. default is amqp://guest@localhost//

--loader

name of custom loader class to use.

--config

Name of the configuration module

-C, --no-color

Disable colors in output.

-q, --quiet

Give less verbose output (behavior depends on the sub command).

--help

Show help and exit.

Daemon Options

These options are supported by commands that can detach into the background (daemon). They will be present in any command that also has a –detach option.

-f, --logfile

Path to log file. If no logfile is specified, stderr is used.

--pidfile

Optional file used to store the process pid.

The program won’t start if this file already exists and the pid is still alive.

--uid

User id, or user name of the user to run as after detaching.

--gid

Group id, or group name of the main group to change to after detaching.

--umask

Effective umask (in octal) of the process after detaching. Inherits the umask of the parent process by default.

--workdir

Optional directory to change to after detaching.

--executable

Executable to use for the detached process.

celery inspect

-t, --timeout

Timeout in seconds (float) waiting for reply

-d, --destination

Comma separated list of destination node names.

-j, --json

Use json as output format.

celery control

-t, --timeout

Timeout in seconds (float) waiting for reply

-d, --destination

Comma separated list of destination node names.

-j, --json

Use json as output format.

celery migrate

-n, --limit

Number of tasks to consume (int).

-t, -timeout

Timeout in seconds (float) waiting for tasks.

-a, --ack-messages

Ack messages from source broker.

-T, --tasks

List of task names to filter on.

-Q, --queues

List of queues to migrate.

-F, --forever

Continually migrate tasks until killed.

celery upgrade

--django

Upgrade a Django project.

--compat

Maintain backwards compatibility.

--no-backup

Don’t backup original files.

celery shell

-I, --ipython

Force iPython implementation.

-B, --bpython

Force bpython implementation.

-P, --python

Force default Python shell.

-T, --without-tasks

Don’t add tasks to locals.

--eventlet

Use eventlet monkey patches.

--gevent

Use gevent monkey patches.

celery result

-t, --task

Name of task (if custom backend).

--traceback

Show traceback if any.

celery purge

-f, --force

Don’t prompt for verification before deleting messages (DANGEROUS)

celery call

-a, --args

Positional arguments (json format).

-k, --kwargs

Keyword arguments (json format).

--eta

Scheduled time in ISO-8601 format.

--countdown

ETA in seconds from now (float/int).

--expires

Expiry time in float/int seconds, or a ISO-8601 date.

--serializer

Specify serializer to use (default is json).

--queue

Destination queue.

--exchange

Destination exchange (defaults to the queue exchange).

--routing-key

Destination routing key (defaults to the queue routing key).

class celery.bin.celery.CeleryCommand(app=None, get_app=None, no_color=False, stdout=None, stderr=None, quiet=False, on_error=None, on_usage_error=None)[source]

Base class for commands.

commands = {'amqp': <class 'celery.bin.amqp.amqp'>, 'beat': <class 'celery.bin.beat.beat'>, 'call': <class 'celery.bin.call.call'>, 'control': <class 'celery.bin.control.control'>, 'events': <class 'celery.bin.events.events'>, 'graph': <class 'celery.bin.graph.graph'>, 'help': <class 'celery.bin.celery.help'>, 'inspect': <class 'celery.bin.control.inspect'>, 'list': <class 'celery.bin.list.list_'>, 'logtool': <class 'celery.bin.logtool.logtool'>, 'migrate': <class 'celery.bin.migrate.migrate'>, 'multi': <class 'celery.bin.celery.multi'>, 'purge': <class 'celery.bin.purge.purge'>, 'report': <class 'celery.bin.celery.report'>, 'result': <class 'celery.bin.result.result'>, 'shell': <class 'celery.bin.shell.shell'>, 'status': <class 'celery.bin.control.status'>, 'upgrade': <class 'celery.bin.upgrade.upgrade'>, 'worker': <class 'celery.bin.worker.worker'>}
enable_config_from_cmdline = True
execute(command, argv=None)[source]
execute_from_commandline(argv=None)[source]

Execute application from command-line.

Parameters:argv (List[str]) – The list of command-line arguments. Defaults to sys.argv.
ext_fmt = '{self.namespace}.commands'
classmethod get_command_info(command, indent=0, color=None, colored=None, app=None)[source]
handle_argv(prog_name, argv, **kwargs)[source]

Parse arguments from argv and dispatch to run().

Warning

Exits with an error message if supports_args is disabled and argv contains positional arguments.

Parameters:
  • prog_name (str) – The program name (argv[0]).
  • argv (List[str]) – Rest of command-line arguments.
classmethod list_commands(indent=0, colored=None, app=None)[source]
load_extension_commands()[source]
namespace = 'celery'
on_concurrency_setup()[source]
on_usage_error(exc, command=None)[source]
prepare_prog_name(name)[source]
prog_name = 'celery'
classmethod register_command(fun, name=None)[source]
with_pool_option(argv)[source]

Return tuple of (short_opts, long_opts).

Returns only if the command supports a pool argument, and used to monkey patch eventlet/gevent environments as early as possible.

Example

>>> has_pool_option = (['-P'], ['--pool'])
celery.bin.celery.main(argv=None)[source]

Start celery umbrella command.