From 3085f2f0fab7ab1c460e8c4319ca83059a5c20b0 Mon Sep 17 00:00:00 2001 From: Matthieu Imbert <matthieu.imbert@inria.fr> Date: Wed, 31 Jan 2024 09:37:47 +0100 Subject: [PATCH] [remote] add substitutions to filenames in stdout/stderr handlers --- src/execo/action.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/execo/action.py b/src/execo/action.py index 10693cd..3ac684f 100644 --- a/src/execo/action.py +++ b/src/execo/action.py @@ -27,7 +27,7 @@ from .report import Report from .ssh_utils import get_rewritten_host_address, get_scp_command, \ get_taktuk_connector_command, get_ssh_command from .utils import name_from_cmdline, non_retrying_intr_cond_wait, intr_event_wait, get_port, \ - singleton_to_collection + singleton_to_collection, is_string from traceback import format_exc from .substitutions import get_caller_context, remote_substitute from .time_utils import get_seconds, format_date, Timer @@ -543,10 +543,20 @@ class Remote(Action): self.processes = [] processlh = ActionNotificationProcessLH(self, len(self.hosts)) for (index, host) in enumerate(self.hosts): + this_process_args = self.process_args.copy() + for handler_kind in ['stdout_handlers', 'stderr_handlers']: + if handler_kind in this_process_args: + new_handlers = [] + for h in this_process_args[handler_kind]: + if is_string(h): + new_handlers.append(remote_substitute(h, self.hosts, index, self._caller_context)) + else: + new_handlers.append(h) + this_process_args[handler_kind] = new_handlers p = SshProcess(remote_substitute(self.cmd, self.hosts, index, self._caller_context), host = host, connection_params = self.connection_params, - **self.process_args) + **this_process_args) p.lifecycle_handlers.append(processlh) self.processes.append(p) -- GitLab