(self)
| 119 | return stat_result |
| 120 | |
| 121 | def kill_scc_process(self): |
| 122 | scc_workdir = PathMgr().format_path(self._task_dir) |
| 123 | pids = psutil.pids() |
| 124 | for pid in pids: |
| 125 | try: |
| 126 | # 运行时候可能刚好有个进程退出,导致出现找不到进程错误 |
| 127 | # 2020/4/28 windows的进程命令不一样,并且杀进程时候不一定三个子进程已经起起来 |
| 128 | p = psutil.Process(pid) |
| 129 | # children = p.children() |
| 130 | # LogPrinter.info(f"pid: {pid}") |
| 131 | # LogPrinter.info(f"pname: {p.name()}") |
| 132 | if p.name().lower().startswith("scc") and " ".join(p.cmdline()).find(scc_workdir) != -1: |
| 133 | LogPrinter.info(f"find and kill scc process, pid: {pid}, " |
| 134 | f"pname: {p.name()}, cmdline: {' '.join(p.cmdline())}") |
| 135 | ProcMgr().kill_proc_famliy(pid) |
| 136 | except Exception as e: |
| 137 | LogPrinter.warning("kill scc process failed: %s" % str(e)) |
no test coverage detected