support workder name override from config file (#947)

* support workder name override from config file

* update docs for NAME config

* Update workers.md
main
Qingping Hou 6 years ago committed by Selwin Ong
parent e00ff97867
commit 051104b0ff

@ -225,6 +225,9 @@ QUEUES = ['high', 'normal', 'low']
# to configure RQ for it in a single step # to configure RQ for it in a single step
# The 'sync+' prefix is required for raven: https://github.com/nvie/rq/issues/350#issuecomment-43592410 # The 'sync+' prefix is required for raven: https://github.com/nvie/rq/issues/350#issuecomment-43592410
SENTRY_DSN = 'sync+http://public:secret@example.com/1' SENTRY_DSN = 'sync+http://public:secret@example.com/1'
# If you want custom worker name
# NAME = 'worker-1024'
{% endhighlight %} {% endhighlight %}
The example above shows all the options that are currently supported. The example above shows all the options that are currently supported.

@ -196,6 +196,7 @@ def worker(cli_config, burst, logging_level, name, results_ttl,
# Worker specific default arguments # Worker specific default arguments
queues = queues or settings.get('QUEUES', ['default']) queues = queues or settings.get('QUEUES', ['default'])
sentry_dsn = sentry_dsn or settings.get('SENTRY_DSN') sentry_dsn = sentry_dsn or settings.get('SENTRY_DSN')
name = name or settings.get('NAME')
if pid: if pid:
with open(os.path.expanduser(pid), "w") as fp: with open(os.path.expanduser(pid), "w") as fp:

Loading…
Cancel
Save