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

Method get_project_load_info

class/projectModel/nodejsModel.py:1717–1740  ·  view source on GitHub ↗

@name 获取项目负载信息 @author hwliang<2021-08-12> @param get { project_name: string<项目名称> } @return dict

(self,get = None,project_name = None)

Source from the content-addressed store, hash-verified

1715
1716
1717 def get_project_load_info(self,get = None,project_name = None):
1718 ''&#x27;
1719 @name 获取项目负载信息
1720 @author hwliang<2021-08-12>
1721 @param get<dict_obj>{
1722 project_name: string<项目名称>
1723 }
1724 @return dict
1725 ''&#x27;
1726 if get: project_name = get.project_name.strip()
1727 load_info = {}
1728 pid_file = "{}/{}.pid".format(self._node_pid_path,project_name)
1729 if not os.path.exists(pid_file): return load_info
1730 data = public.readFile(pid_file)
1731 if isinstance(data,str) and data:
1732 pid = int(data)
1733 pids = self.get_project_pids(pid=pid)
1734 else:
1735 return load_info
1736 if not pids: return load_info
1737 for i in pids:
1738 process_info = self.get_process_info_by_pid(i)
1739 if process_info: load_info[i] = process_info
1740 return load_info
1741
1742 def get_pm2_load_info(self,get = None,project_name = None):
1743 ''&#x27;

Callers 1

get_project_statMethod · 0.95

Calls 5

get_project_pidsMethod · 0.95
readFileMethod · 0.80
formatMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected