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

Method get_other_pids

class/projectModel/javaModel.py:2447–2477  ·  view source on GitHub ↗

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

(self, pid)

Source from the content-addressed store, hash-verified

2445 return self._ckeck_add_domain(get.project_name, res_domains)
2446
2447 def get_other_pids(self, pid):
2448 ''&#x27;
2449 @name 获取其他进程pid列表
2450 @author hwliang<2021-08-10>
2451 @param pid: string<项目pid>
2452 @return list
2453 ''&#x27;
2454 plugin_name = None
2455 for pid_name in os.listdir(self._springboot_pid_path):
2456 pid_file = '{}/{}'.format(self._springboot_pid_path, pid_name)
2457 try:
2458 s_pid = int(public.readFile(pid_file))
2459 except:
2460 continue
2461 if pid == s_pid:
2462 plugin_name = pid_name[:-4]
2463 break
2464 project_find = self.get_project_find(plugin_name)
2465 if not project_find: return []
2466 if not self._pids: self._pids = psutil.pids()
2467 all_pids = []
2468 for i in self._pids:
2469 try:
2470 p = psutil.Process(i)
2471 if p.cwd() == project_find['project_config']['jar_path'] and p.username() == \
2472 project_find['project_config']['run_user']:
2473 if p.name() in ['java', 'jsvc', 'jsvc.exec']:
2474 all_pids.append(i)
2475 except:
2476 continue
2477 return all_pids
2478
2479 def get_project_pids(self, get=None, pid=None):
2480 ''&#x27;

Callers

nothing calls this directly

Calls 6

get_project_findMethod · 0.95
listdirMethod · 0.80
readFileMethod · 0.80
formatMethod · 0.45
nameMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected