如何停止芹菜工作进程芹菜、进程、工作

2023-09-11 09:20:54 作者:灰太狼

我有一个Ubuntu EC2节点,我一直在使用使用芹菜来建立一个异步其中一个Django项目。

我下面此内容随着文档。

我已经能够获得一个基本的任务,在命令行工作,使用:

 (ENV1)的ubuntu @ IP-172-31-22-65:〜/项目/目标价$芹菜--app = myproject.celery:应用工人--loglevel = INFO
 

要启动工作。因为我已经做了一些修改了Python,但意识到我需要重新启动的工人。

在命令行中,我尝试过:

  PS auxww | grep的芹菜工作者| awk的'{打印$ 2}'| xargs的杀-9
 

不过,我可以看到,工人仍在运行。

如何才能杀死它?

编辑:

 (ENV1)的ubuntu @ IP-172-31-22-65:〜/项目/目标价$ sudo的PS auxww | grep的celeryd | grep的-v的grep| awk的'{打印$ 2}'|须藤xargs的杀-HUP
杀:无效的参数^ h

用法:
 杀[选项]< PID> [...]

选项​​:
 < PID> [...]将信号发送到每个< PID>上市
  - <信号>中-s,--signal<信号GT;
                        指定的<信号>要发送
 -l,--list =并[d信号GT]列表中的所有的信号名称,或者将一个到一个名
 -L,--table列表中一个不错的表中的所有信号名称

 -h,--help显示帮助并退出
 -V,--version输出版本信息并退出

详情请参阅杀(1)。
 
windows资源管理器已停止工作怎么解决

编辑2:

 (ENV1)的ubuntu @ IP-172-31-22-65:〜/项目/目标价$的ps aux | grep的芹菜
Ubuntu的9756 0.0 3.4 100868 35508点/ 6 S + 15:49 0:07 /home/ubuntu/.virtualenvs/env1/bin/python3.4 /home/ubuntu/.virtualenvs/env1/bin/celery --app = TP。芹菜:应用工人--loglevel = INFO
Ubuntu的9760 0.0 3.9 255840 39852点/ 6 S + 15:49 0:05 /home/ubuntu/.virtualenvs/env1/bin/python3.4 /home/ubuntu/.virtualenvs/env1/bin/celery --app = TP。芹菜:应用工人--loglevel = INFO
Ubuntu的12760 0.0 0.0 10464 932点/ 7 S + 19:04 0:00 grep的--color =汽车芹菜
 

解决方案

在终端试试这个

 的ps aux | grep的芹菜工作者
 

您会看到这样

 用户名29042 0.0 0.6 23216 14356点/ 1个S + 00:18 0:01 /斌/芹菜工...
 

然后通过

杀进程id

 须藤杀死-9这里PROCESS_ID#29042
 

如果您有多个进程,那么你必须杀死使用上述杀死所有进程id 条命令

 须藤杀死-9 ID1 ID2 ID3 ...
 

从芹菜DOC

  PS auxww | grep的芹菜工作者| awk的'{打印$ 2}'| xargs的杀-9
 

或者如果你正在运行的 celeryd

  PS auxww | grep的celeryd | awk的'{打印$ 2}'| xargs的杀-9
 

注意

主管

如果您运行的是芹菜,即使杀的过程中,它会自动重新启动(如果自动重启=真正的导师脚本)。

希望这有助于

I have a Django project on an Ubuntu EC2 node, which I have been using to set up an asynchronous using Celery.

I am following this along with the docs.

I've been able to get a basic task working at the command line, using:

(env1)ubuntu@ip-172-31-22-65:~/projects/tp$ celery --app=myproject.celery:app worker --loglevel=INFO

To start a worker. I have since made some changes to the Python, but realized that I need to restart a worker.

From the command line, I've tried:

 ps auxww | grep 'celery worker' | awk '{print $2}' | xargs kill -9

But I can see that the worker is still running.

How can I kill it?

edit:

(env1)ubuntu@ip-172-31-22-65:~/projects/tp$ sudo ps auxww | grep celeryd | grep -v "grep" | awk '{print $2}' | sudo xargs kill -HUP
kill: invalid argument H

Usage:
 kill [options] <pid> [...]

Options:
 <pid> [...]            send signal to every <pid> listed
 -<signal>, -s, --signal <signal>
                        specify the <signal> to be sent
 -l, --list=[<signal>]  list all signal names, or convert one to a name
 -L, --table            list all signal names in a nice table

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see kill(1).

edit 2:

(env1)ubuntu@ip-172-31-22-65:~/projects/tp$ ps aux|grep celery
ubuntu    9756  0.0  3.4 100868 35508 pts/6    S+   15:49   0:07 /home/ubuntu/.virtualenvs/env1/bin/python3.4 /home/ubuntu/.virtualenvs/env1/bin/celery --app=tp.celery:app worker --loglevel=INFO
ubuntu    9760  0.0  3.9 255840 39852 pts/6    S+   15:49   0:05 /home/ubuntu/.virtualenvs/env1/bin/python3.4 /home/ubuntu/.virtualenvs/env1/bin/celery --app=tp.celery:app worker --loglevel=INFO
ubuntu   12760  0.0  0.0  10464   932 pts/7    S+   19:04   0:00 grep --color=auto celery

解决方案

Try this in terminal

ps aux|grep 'celery worker'

You will see like this

username  29042  0.0  0.6  23216 14356 pts/1    S+   00:18   0:01 /bin/celery worker ...

Then kill process id by

sudo kill -9 process_id # here 29042

If you have multiple processes, then you have to kill all process id using above kill commmand

sudo kill -9 id1 id2 id3 ...

From the celery doc

ps auxww | grep 'celery worker' | awk '{print $2}' | xargs kill -9

OR if you are running celeryd

ps auxww | grep celeryd | awk '{print $2}' | xargs kill -9

Note

If you are running celery in supervisor, even though kill the process, it automatically restarts(if autorestart=True in supervisor script).

Hope this helps

 
精彩推荐
图片推荐