最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】supervisor管理celery时是否需要设置workdir参数

celery crifan 4516浏览 0评论

折腾:

【已解决】把Celery+Redis集成到在线Flask中且用supervisor去管理后台服务

期间,给celery加参数之前,先去看看help:

<code>➜  server celery --help
usage: celery &lt;command&gt; [options]

Show help screen and exit.

positional arguments:
  args

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

Global Options:
  -A APP, --app APP
  -b BROKER, --broker BROKER
  --loader LOADER
  --config CONFIG
  --workdir WORKDIR
  --no-color, -C
  --quiet, -q

---- -- - - ---- Commands- -------------- --- ------------

+ Main:
|    celery worker
|    celery events
|    celery beat
|    celery shell
|    celery multi
|    celery amqp

+ Remote Control:
|    celery status

|    celery inspect --help
|    celery inspect active
|    celery inspect active_queues
|    celery inspect clock
|    celery inspect conf [include_defaults=False]
|    celery inspect memdump [n_samples=10]
|    celery inspect memsample
|    celery inspect objgraph [object_type=Request] [num=200 [max_depth=10]]
|    celery inspect ping
|    celery inspect query_task [id1 [id2 [... [idN]]]]
|    celery inspect registered [attr1 [attr2 [... [attrN]]]]
|    celery inspect report
|    celery inspect reserved
|    celery inspect revoked
|    celery inspect scheduled
|    celery inspect stats

|    celery control --help
|    celery control add_consumer &lt;queue&gt; [exchange [type [routing_key]]]
|    celery control autoscale [max [min]]
|    celery control cancel_consumer &lt;queue&gt;
|    celery control disable_events
|    celery control election
|    celery control enable_events
|    celery control heartbeat
|    celery control pool_grow [N=1]
|    celery control pool_restart
|    celery control pool_shrink [N=1]
|    celery control rate_limit &lt;task_name&gt; &lt;rate_limit (e.g., 5/s | 5/m | 5/h)&gt;
|    celery control revoke [id1 [id2 [... [idN]]]]
|    celery control shutdown
|    celery control terminate &lt;signal&gt; [id1 [id2 [... [idN]]]]
|    celery control time_limit &lt;task_name&gt; &lt;soft_secs&gt; [hard_secs]

+ Utils:
|    celery purge
|    celery list
|    celery call
|    celery result
|    celery migrate
|    celery graph
|    celery upgrade

+ Debugging:
|    celery report
|    celery logtool
---- -- - - --------- -- - -------------- --- ------------

Type 'celery &lt;command&gt; --help' for help using a specific command.

</code>

去看看

–workdir

是不是需要用到这个参数去指定工作路径?

python celery 使用及后台运行(supervisor) – CSDN博客

“[program:celery]

command=/usr/bin/celery worker -A tasks

directory=/data/www”

好像是工作路径直接通过supervisor中的directory指定就可以了?

celery workdir

celery.bin.celery — Celery 4.1.0 documentation

“–workdir

Optional directory to change to after detaching.”

celery配置使用 – CSDN博客

看来都是supervisor指定工作目录,暂时不需要去管workdir

【总结】

此处用supervisor管理celery时,用directory指定运行celery的command之前要切换到的目录,好像就可以了。暂时不需要去用celery的workdir去指定工作目录。

转载请注明:在路上 » 【已解决】supervisor管理celery时是否需要设置workdir参数

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.190 seconds, using 22.21MB memory