Skip to content

Commit

Permalink
allow launcher command for flux startup
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-merzky committed Apr 6, 2024
1 parent efac08a commit 5647285
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/radical/utils/flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def _watch(self) -> None:
# --------------------------------------------------------------------------
#
def start_service(self,
env: Optional[Dict[str,str]] = None
launcher: Optional[str] = None
env : Optional[Dict[str,str]] = None
) -> Optional[str]:

with self._lock:
Expand All @@ -129,16 +130,22 @@ def start_service(self,

self._term.clear()

return self._locked_start_service(env)
return self._locked_start_service(launcher, env)


# --------------------------------------------------------------------------
#
def _locked_start_service(self,
env: Optional[Dict[str,str]] = None
launcher: Optional[str] = None
env : Optional[Dict[str,str]] = None
) -> Optional[str]:

cmd = ['flux', 'start', 'bash', '-c', 'echo URI:$FLUX_URI && sleep inf']
cmd = list()

if launcher:
cmd += shlex.split(launcher)

cmd += ['flux', 'start', 'bash', '-c', 'echo URI:$FLUX_URI && sleep inf']

flux_proc = sp.Popen(cmd, encoding="utf-8",
stdin=sp.DEVNULL, stdout=sp.PIPE, stderr=sp.PIPE)
Expand Down Expand Up @@ -403,7 +410,7 @@ def env(self):

# --------------------------------------------------------------------------
#
def start_flux(self) -> None:
def start_flux(self, launcher: Optional[str] = None) -> None:
'''
Start a private Flux instance
Expand All @@ -416,7 +423,7 @@ def start_flux(self) -> None:
raise RuntimeError('service already connected: %s' % self._uri)

self._service = _FluxService(self._uid, self._log, self._prof)
self._service.start_service()
self._service.start_service(launcher=launcher)

self._uri = self._service.check_service()
self._env = self._service.env
Expand Down

0 comments on commit 5647285

Please sign in to comment.