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

Method read_pid

mod/project/python/serviceMod.py:113–127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

111 public.writeFile(pid_file, str(pid))
112
113 def read_pid(self) -> Optional[int]:
114 if not self.env:
115 raise RuntimeError('未设置环境')
116 pid_file = os.path.join(SERVICE_PATH, '{}/{}.pid'.format(self.env.project_name, self.name))
117 if not os.path.isfile(pid_file):
118 return None
119
120 res = None
121 try:
122 res = int(public.readFile(pid_file))
123 except:
124 pass
125 if isinstance(res, int) and res > 0:
126 return res
127 return None
128
129 @classmethod
130 def from_config(cls, config: dict,

Callers 1

get_service_pidMethod · 0.95

Calls 3

readFileMethod · 0.80
joinMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected