MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_project_pids

Method get_project_pids

class/projectModel/javaModel.py:2479–2510  ·  view source on GitHub ↗

@name 获取项目进程pid列表 @author hwliang<2021-08-10> @param pid: string<项目pid> @return list

(self, get=None, pid=None)

Source from the content-addressed store, hash-verified

2477 return all_pids
2478
2479 def get_project_pids(self, get=None, pid=None):
2480 ''&#x27;
2481 @name 获取项目进程pid列表
2482 @author hwliang<2021-08-10>
2483 @param pid: string<项目pid>
2484 @return list
2485 ''&#x27;
2486 if get: pid = int(get.pid)
2487 if not self._pids: self._pids = psutil.pids()
2488 project_pids = []
2489 if pid not in self._pids: return []
2490 for i in self._pids:
2491 try:
2492 p = psutil.Process(i)
2493 if p.status() == "zombie":
2494 continue
2495 if p.ppid() == pid:
2496 if i in project_pids:
2497 continue
2498 project_pids.append(i)
2499 except:
2500 continue
2501 other_pids = []
2502 for i in project_pids:
2503 other_pids += self.get_project_pids(pid = i)
2504 if os.path.exists('/proc/{}'.format(pid)):
2505 project_pids.append(pid)
2506
2507 all_pids = list(set(project_pids + other_pids))
2508 # if not all_pids:
2509 # all_pids = self.get_other_pids(pid)
2510 return sorted(all_pids)
2511
2512 def stop_project(self, get):
2513 ''&#x27;

Callers 8

get_project_run_stateMethod · 0.95
get_duli_run_stateMethod · 0.95
get_project_load_infoMethod · 0.95
get_duli_load_infoMethod · 0.95
stop_projectMethod · 0.95
start_projectMethod · 0.95

Calls 5

setFunction · 0.50
statusMethod · 0.45
appendMethod · 0.45
existsMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected