Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/drunc/process_manager/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ def find_by_uuid(pi_list, target_uuid: str):
)
continue
pi = find_by_uuid(results, diff)
err_msg = f"Process {pi.process_description.metadata.name} has died with a return code {pi.return_code}"
pi_return_code = (
pi.return_code if pi.HasField("return_code") else "NONE"
)
err_msg = f"Process {pi.process_description.metadata.name} has died with a return code {pi_return_code}"
if not self.ers_handler_initialized:
setup_daq_ers_logger(
self.log,
Expand Down
5 changes: 4 additions & 1 deletion src/drunc/process_manager/ssh_process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,10 +697,13 @@ def _flush_impl(self, query: ProcessQuery) -> ProcessInstanceList:
proc_uuid, self.configuration.data.kill_timeout
)

pi_return_code = (
pi.return_code if pi.HasField("return_code") else "NONE"
)
self.log.info(
f"Flushed dead process {proc_uuid} "
f"(name: {pi.process_description.metadata.name}, "
f"exit code: {pi.return_code})."
f"exit code: {pi_return_code})."
)
flushed.append(pi)

Expand Down
8 changes: 6 additions & 2 deletions src/drunc/process_manager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ def tabulate_process_instance_list(
else "[danger]False[/danger]"
)
row = [m.session, line, m.user, m.hostname, process.uuid.uuid]
row += [alive, f"{process.return_code}"]

process_return_code = (
process.return_code if process.HasField("return_code") else "NONE"
)
row += [alive, f"{process_return_code}"]
if show_remote_pid:
row += [
process.remote_pid
Expand Down Expand Up @@ -322,6 +326,7 @@ def get_pm_type_from_name(pm_name: str) -> ProcessManagerTypes:

return pmch.data.type


def format_hostname(hostname: str) -> str:
"""
Format the host name to truly reflect what the host name is, removing any extensions
Expand Down Expand Up @@ -351,4 +356,3 @@ def format_hostname(hostname: str) -> str:
formatted_hostname = hostname[:-2]

return formatted_hostname

Loading