(self, only_service: bool = False)
| 181 | return self.get_service_pid() |
| 182 | |
| 183 | def get_service_pid(self, only_service: bool = False) -> Optional[int]: |
| 184 | pid = self.read_pid() |
| 185 | if pid and psutil.pid_exists(pid): |
| 186 | return pid |
| 187 | |
| 188 | if not pid: |
| 189 | pid = self.get_pid_by_env_key() |
| 190 | if not pid and not only_service: |
| 191 | pid = self.get_pid_by_command() |
| 192 | |
| 193 | if pid: |
| 194 | self.write_pid(pid) |
| 195 | return pid |
| 196 | return None |
| 197 | |
| 198 | def get_pid_by_env_key(self) -> Optional[int]: |
| 199 | env_key = "BT_PYTHON_SERVICE_SID={}".format(self.sid) |
no test coverage detected