Skip to content

Commit

Permalink
[Async] Add get_process_status for remote run (open-s4c#50)
Browse files Browse the repository at this point in the history
Add simple implementation of `get_process_status` for remote execution.

The process status obtained is that of the SSH process and not of the
`async process` itself.
This, however, is sufficient to detect the termination of the `async
process` in current use-cases of this function.

Signed-off-by: Rafael Chehab <[email protected]>
  • Loading branch information
rchehab authored Jul 17, 2024
1 parent f93e271 commit 3476514
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion benchkit/communication/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,20 @@ def get_process_nb_threads(self, process_handle: subprocess.Popen) -> int:
raise NotImplementedError("TODO")

def get_process_status(self, process_handle: subprocess.Popen) -> str:
raise NotImplementedError("TODO")
"""
Add simple implementation of `get_process_status` which uses the status of the SSH process
and not of the `async process` in order to detect its termination
"""
pid = process_handle.pid
status = shell_out(
f"ps -q {pid} -o state --no-headers",
print_input=False,
print_output=False,
print_env=False,
print_curdir=False,
print_file_shell_cmd=False,
)
return status.strip()

def path_exists(self, path: PathType) -> bool:
try:
Expand Down

0 comments on commit 3476514

Please sign in to comment.