From 4d84ffb4d85f7a666b52ad3befd11d3c8f4e7ec1 Mon Sep 17 00:00:00 2001 From: Andre Merzky Date: Mon, 27 May 2024 08:28:05 +0200 Subject: [PATCH] loggedilog --- src/radical/utils/flux.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/radical/utils/flux.py b/src/radical/utils/flux.py index 31af79a2..8c51e5d2 100644 --- a/src/radical/utils/flux.py +++ b/src/radical/utils/flux.py @@ -144,7 +144,10 @@ def _locked_start_service(self, if launcher: cmd += shlex.split(launcher) - cmd += ['flux', 'start', 'bash', '-c', 'echo URI:$FLUX_URI && sleep inf'] + cmd += ['flux', 'start', 'bash', '-c', + 'echo "HOST:$(hostname) URI:$FLUX_URI" && sleep inf'] + + selg._log.debug('=== flux command', cmd) flux_proc = sp.Popen(cmd, encoding="utf-8", stdin=sp.DEVNULL, stdout=sp.PIPE, stderr=sp.PIPE) @@ -162,11 +165,17 @@ def _locked_start_service(self, if not line: continue - self._log.debug('flux output: %s', line) + self._log.debug('=== flux output: %s', line) + + if line.startswith('HOST:'): + + flux_host, flux_uri = line.split(' ', 1) - if line.startswith('URI:'): - flux_uri = line.split(':', 1)[1].strip() - flux_env['FLUX_URI'] = flux_uri + flux_host = flux_host.split(':', 1)[1].strip() + flux_uri = flux_uri.split(':', 1)[1].strip() + + flux_env['FLUX_HOST'] = flux_host + flux_env['FLUX_URI'] = flux_uri break if flux_proc.poll() is not None: @@ -181,7 +190,7 @@ def _locked_start_service(self, # make sure that the flux url can be reached from other hosts # FIXME: this also routes local access via ssh which may slow comm flux_url = Url(flux_env['FLUX_URI']) - flux_url.host = get_hostname() + flux_url.host = flux_env['FLUX_HOST'] flux_url.schema = 'ssh' flux_uri = str(flux_url) flux_env['FLUX_URI'] = flux_uri @@ -190,6 +199,8 @@ def _locked_start_service(self, self._env = flux_env self._proc = flux_proc + selg._log.debug('=== flux uri', flux_uri) + self._prof.prof('flux_started', msg=self._uid) # start watcher thread to monitor the instance