Skip to content

Commit 8acd44e

Browse files
grondomergify[bot]
authored andcommitted
python: uri: use path to current flux executable in lsf resovler
Problem: The lsf URI resolver plugin executes `ssh flux uri resolve..` on a compute host during URI resolution, but this may not work if the remote host has a different version of Flux installed as the system instance. Assume a shared filesystem by default and replace `flux` with the path to the local flux executable by using shutil.which("flux"). As with the ssh connector, allow this to be overridden with `FLUX_SSH_RCMD`. Fixes #4558
1 parent c315685 commit 8acd44e

File tree

1 file changed

+13
-1
lines changed
  • src/bindings/python/flux/uri/resolvers

1 file changed

+13
-1
lines changed

src/bindings/python/flux/uri/resolvers/lsf.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import getpass
2020
import os
2121
import subprocess
22+
import shutil
2223
from pathlib import PurePath
2324

2425
import yaml
@@ -79,8 +80,19 @@ def lsf_get_uri(hostname, jobid):
7980
and converting the result from bytecode to a string.
8081
"""
8182
ssh_path = os.getenv("FLUX_SSH", "ssh")
83+
84+
# Allow path to remote flux to be overridden as in ssh connector,
85+
# o/w, use path the current `flux` executable:
86+
flux_cmd_path = os.getenv("FLUX_SSH_RCMD", shutil.which("flux"))
8287
sp = subprocess.run(
83-
[ssh_path, hostname, "flux", "uri", "--remote", f"lsf:{jobid}?is_compute"],
88+
[
89+
ssh_path,
90+
hostname,
91+
flux_cmd_path,
92+
"uri",
93+
"--remote",
94+
f"lsf:{jobid}?is_compute",
95+
],
8496
stdout=subprocess.PIPE,
8597
check=True,
8698
)

0 commit comments

Comments
 (0)