干净利落地终止进程。发送一个SIGTERM信号,等待它死掉,如果没有,SIGKILL进程树中从较高(最近)到较低(以前)的PID值的所有子进程。

ckill的Python项目详细描述


允许安全、干净地终止多进程应用程序的实用程序 当SIGTERM为 收到。在

ckill向主进程发送一个SIGTERM信号,等待它死,如果 它不会在一段时间后,SIGKILL进程树中的所有子进程 从较高(最近)到较低(以前)的PID值。在

通过这种方式,ckill允许进程正确终止,但是如果 终止时发生故障,或如果需要太长时间(由 user)它的所有子进程被终止,然后主进程本身被终止,离开 后面没有僵尸进程。在

DON'T SIGKILL 2

如果要开发Python多进程应用程序,请参见 https://github.com/kuralabs/multiexit

安装

pip3 install ckill

(可选)安装以下软件包以启用颜色日志输出。在

^{pr2}$

使用

usage: ckill [-h] [-v] [--version] [--no-color] [--timeout-s TIMEOUT_S] PID

Cleanly kills a process

positional arguments:
  PID                   PID of process to kill

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Increase verbosity level
  --version             show program's version number and exit
  --no-color            Do not colorize the log output
  --timeout-s TIMEOUT_S
                        Maximum time to wait for the process to die, in seconds.

变更日志

1.0.1(2020-12-01)

  • 修复错误的psutil API调用。在

1.0.0(2020-10-15)

  • 初始版本。在

许可证

Copyright (C) 2020 KuraLabs S.R.L

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java是从此类字符串中提取数据的最佳方法   filenotfoundexception Java FileOutputStream Windows/Linux   java在SQLite数据库Android SDK中搜索特定字符串   java使用键值访问jsp中Map<Long,Map<String,Object>>的内容   java奇怪的HTMLeditor工具包问题   在java中使用数组只计算字母   每个应用程序都可以有自己独立的Java SDK吗   java如何将jasper报告生成的PDF文件保存在一个项目文件夹中   java BigDecimal包装器:静态字段为零   解码Base64图像时出现java IllegalArgumentException(非法的Base64字符)   将int转换为字节在Java和Actionscript中产生不同的结果   java什么使不可变对象在没有安全发布技术的情况下发布?   java将字节数据写入目录   一个计算器中有多个操作的java问题   面向对象Java重写是如何工作的   带hibernate的java ClassCastException   指向最后一个对象的java对象列表   java单元测试spring项目中的Get请求