Skip to content

Commit 2068415

Browse files
committed
Fix more lint errors
Signed-off-by: Min Lim <min.yeol.lim@intel.com>
1 parent d40f873 commit 2068415

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

gprofiler/profilers/php.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ def _dump(self) -> Optional[Path]:
162162
logger.error("phpspy process is not running")
163163
return None
164164
else:
165-
self._process.send_signal(self.dump_signal)
165+
if self._process is not None:
166+
self._process.send_signal(self.dump_signal)
166167

167168
# important to not grab the transient data file
168169
while True:

gprofiler/profilers/python_ebpf.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ def _dump(self) -> Optional[Path]:
284284
logger.error("PyPerf process is not running")
285285
return None
286286
else:
287-
self.process.send_signal(self._DUMP_SIGNAL)
287+
if self.process is not None:
288+
self.process.send_signal(self._DUMP_SIGNAL)
288289

289290
try:
290291
# important to not grab the transient data file - hence the following '.'
@@ -300,10 +301,14 @@ def _dump(self) -> Optional[Path]:
300301
process = self.process # save it
301302
exit_status, stderr, stdout = self._terminate()
302303
assert exit_status is not None, "PyPerf didn't exit after _terminate()!"
303-
assert isinstance(process.args, list) and all(
304-
isinstance(s, str) for s in process.args
305-
), process.args # mypy
306-
raise PythonEbpfError(exit_status, process.args, stdout, stderr)
304+
if process is not None:
305+
assert isinstance(process.args, list) and all(
306+
isinstance(s, str) for s in process.args
307+
), process.args # mypy
308+
cmd_args: List[str] = list(process.args) # type: ignore
309+
else:
310+
cmd_args: List[str] = []
311+
raise PythonEbpfError(exit_status, cmd_args, stdout, stderr)
307312

308313
def snapshot(self) -> ProcessToProfileData:
309314
# Add health check at the beginning

0 commit comments

Comments
 (0)