def get_all_p_for_pgid():
current_pgid = os.getpgid(os.getpid())
running_pid = []
for pid in psutil.process_iter():
try:
pgid = os.getpgid(pid)
except:
continue
# Don't try to kill HPOlib-run
if pgid == current_pgid and pid != os.getpid():
# This solves the problem that a Zombie process counts
# towards the number of process which have to be killed
running_pid.append(pid)
return running_pid
评论列表
文章目录