使用 sudo 命令启动 celery
start celery with sudo command
我正在使用 Celery 并尝试使用 sudo 启动它。 sudo celery multi start worker --app=app.celery --loglevel=info --concurrency=1
我需要 运行 使用 sudo 命令,但是当我这样做时,我遇到了权限错误。如何使用 sudo 命令启动 Celery?
我已尝试阅读文档,但不清楚 Celery Docs
sudo celery multi start worker --app=app.celery --loglevel=info --concurrency=1
celery multi v4.2.1 (windowlicker)
> Starting nodes...
> worker@xr-npu-perf-lnx: OK
Traceback (most recent call last):
File "/auto/pysw/cel7x/python64/3.4.1/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/auto/pysw/cel7x/python64/3.4.1/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/__main__.py", line 20, in <module>
main()
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/__main__.py", line 16, in main
_main()
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 322, in main
cmd.execute_from_commandline(argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/base.py", line 275, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 488, in handle_argv
return self.execute(command, argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 420, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/worker.py", line 222, in run_from_argv
self.maybe_detach([command] + argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/worker.py", line 229, in maybe_detach
detached_celeryd(self.app).execute_from_commandline(argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celeryd_detach.py", line 99, in execute_from_commandline
**vars(options)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celeryd_detach.py", line 35, in detach
after_forkers=False):
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/platforms.py", line 335, in open
self.after_chdir()
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/platforms.py", line 412, in after_chdir_do
logfile and open(logfile, 'a').close()
PermissionError: [Errno 13] Permission denied: 'worker.log'
由于日志目录的位置,您 运行 遇到权限错误。您可以使用 -f
指定日志文件。所以也许是这样的:
sudo celery multi start worker --app=app.celery --loglevel=info --concurrency=1 -f /tmp/celery.log
应该可以解决问题。如果没记错的话,您可能还必须将 C_FORCE_ROOT
环境变量设置为 1 才能使其正常工作。
我正在使用 Celery 并尝试使用 sudo 启动它。 sudo celery multi start worker --app=app.celery --loglevel=info --concurrency=1
我需要 运行 使用 sudo 命令,但是当我这样做时,我遇到了权限错误。如何使用 sudo 命令启动 Celery?
我已尝试阅读文档,但不清楚 Celery Docs
sudo celery multi start worker --app=app.celery --loglevel=info --concurrency=1
celery multi v4.2.1 (windowlicker)
> Starting nodes...
> worker@xr-npu-perf-lnx: OK
Traceback (most recent call last):
File "/auto/pysw/cel7x/python64/3.4.1/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/auto/pysw/cel7x/python64/3.4.1/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/__main__.py", line 20, in <module>
main()
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/__main__.py", line 16, in main
_main()
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 322, in main
cmd.execute_from_commandline(argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 496, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/base.py", line 275, in execute_from_commandline
return self.handle_argv(self.prog_name, argv[1:])
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 488, in handle_argv
return self.execute(command, argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celery.py", line 420, in execute
).run_from_argv(self.prog_name, argv[1:], command=argv[0])
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/worker.py", line 222, in run_from_argv
self.maybe_detach([command] + argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/worker.py", line 229, in maybe_detach
detached_celeryd(self.app).execute_from_commandline(argv)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celeryd_detach.py", line 99, in execute_from_commandline
**vars(options)
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/bin/celeryd_detach.py", line 35, in detach
after_forkers=False):
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/platforms.py", line 335, in open
self.after_chdir()
File "/auto/nest/xr-perf-site/xr-perf-pyats-env/lib/python3.4/site-packages/celery/platforms.py", line 412, in after_chdir_do
logfile and open(logfile, 'a').close()
PermissionError: [Errno 13] Permission denied: 'worker.log'
由于日志目录的位置,您 运行 遇到权限错误。您可以使用 -f
指定日志文件。所以也许是这样的:
sudo celery multi start worker --app=app.celery --loglevel=info --concurrency=1 -f /tmp/celery.log
应该可以解决问题。如果没记错的话,您可能还必须将 C_FORCE_ROOT
环境变量设置为 1 才能使其正常工作。