usage: dramatiq [-h] [--processes PROCESSES] [--threads THREADS] [--path [PATH ...]]
[--queues [QUEUES ...]] [--pid-file PID_FILE] [--log-file LOG_FILE]
[--skip-logging] [--use-spawn] [--fork-function FORKS]
[--worker-shutdown-timeout WORKER_SHUTDOWN_TIMEOUT] [--watch DIR]
[--watch-use-polling] [-i INCLUDE_PATTERNS] [-x EXCLUDE_PATTERNS] [--version]
[--verbose]
broker [module ...]
Run dramatiq workers.
positional arguments:
broker the broker to use (eg: 'module' or 'module:a_broker')
module additional python modules to import
options:
-h, --help show this help message and exit
--processes, -p PROCESSES
the number of worker processes to run (default: 64)
--threads, -t THREADS
the number of worker threads per process (default: 8)
--path, -P [PATH ...]
the module import path (default: .)
--queues, -Q [QUEUES ...]
listen to a subset of queues (default: all queues)
--pid-file PID_FILE write the PID of the master process to a file (default: no pid file)
--log-file LOG_FILE write all logs to a file (default: sys.stderr)
--skip-logging do not call logging.basicConfig()
--use-spawn start processes by spawning (default: fork on unix, spawn on windows)
--fork-function, -f FORKS
fork a subprocess to run the given function
--worker-shutdown-timeout WORKER_SHUTDOWN_TIMEOUT
timeout for worker shutdown, in milliseconds (default: 10 minutes)
--watch DIR watch a directory and reload the workers when any source files change
(this feature must only be used during development). This option is
currently only supported on unix systems.
--watch-use-polling poll the filesystem for changes rather than using a system-dependent
filesystem event emitter
-i, --watch-include INCLUDE_PATTERNS
Patterns to include when watching for changes. Always includes all python
files (*.py).
-x, --watch-exclude EXCLUDE_PATTERNS
Patterns to ignore when watching for changes
--version show program's version number and exit
--verbose, -v turn on verbose log output
examples:
# Run dramatiq workers with actors defined in `./some_module.py`.
$ dramatiq some_module
# Run with a broker named "redis_broker" defined in "some_module".
$ dramatiq some_module:redis_broker
# Run with a broker named "broker" defined as attribute of "app" in "some_module".
$ dramatiq some_module:app.broker
# Run with a callable that sets up a broker.
$ dramatiq some_module:setup_broker
# Auto-reload dramatiq when files in the current directory change.
$ dramatiq --watch . some_module
# Run dramatiq with 1 thread per process.
$ dramatiq --threads 1 some_module
# Run dramatiq with gevent. Make sure you `pip install gevent` first.
$ dramatiq-gevent --processes 1 --threads 1024 some_module
# Import extra modules. Useful when your main module doesn't import
# all the modules you need.
$ dramatiq some_module some_other_module
# Listen only to the "foo" and "bar" queues.
$ dramatiq some_module -Q foo bar
# Write the main process pid to a file.
$ dramatiq some_module --pid-file /tmp/dramatiq.pid
# Write logs to a file.
$ dramatiq some_module --log-file /tmp/dramatiq.log
Options (15)
| Option | Description | Source |
|---|
-h, --help | show this help message and exit | help |
--processes, -p PROCESSES | the number of worker processes to run (default: 64) | help |
--threads, -t THREADS | the number of worker threads per process (default: 8) | help |
--pid-file PID_FILE | write the PID of the master process to a file (default: no pid file) | help |
--log-file LOG_FILE | write all logs to a file (default: sys.stderr) | help |
--skip-logging | do not call logging.basicConfig() | help |
--use-spawn | start processes by spawning (default: fork on unix, spawn on windows) | help |
--fork-function, -f FORKS | fork a subprocess to run the given function | help |
--worker-shutdown-timeout WORKER_SHUTDOWN_TIMEOUT | timeout for worker shutdown, in milliseconds (default: 10 minutes) | help |
--watch DIR | watch a directory and reload the workers when any source files change (this feature must only be used during development). | help |
--watch-use-polling | poll the filesystem for changes rather than using a system-dependent filesystem event emitter | help |
-i, --watch-include INCLUDE_PATTERNS | Patterns to include when watching for changes. | help |
-x, --watch-exclude EXCLUDE_PATTERNS | Patterns to ignore when watching for changes | help |
--version | show program's version number and exit | help |
--verbose, -v | turn on verbose log output | help |
Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.