Skip to content

Commit

Permalink
dws2jgf: check for rabbit.mapping in config
Browse files Browse the repository at this point in the history
Problem: dws2jgf expects a path to the rabbitmapping file,
but that path is now expected to be found in the config.

Make passing the path on the command line optional, and fall back
to the config if not provided.
  • Loading branch information
jameshcorbett committed Jan 24, 2025
1 parent 4738084 commit 8fa4474
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cmd/flux-dws2jgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def main():
parser.add_argument(
"rabbitmapping",
metavar="FILE",
nargs="?",
help=(
"Path to JSON object giving rabbit layout and capacity, as generated "
"e.g. by the 'flux rabbitmapping' script"
Expand Down Expand Up @@ -257,6 +258,12 @@ def main():
f"error message was {proc.stderr}"
)
input_r = json.loads(proc.stdout)
if args.rabbitmapping is None:
args.rabbitmapping = flux.Flux().conf_get("rabbit.mapping")
if args.rabbitmapping is None:
sys.exit(
"Could not fetch rabbit.mapping from config, Flux may be misconfigured"
)
with open(args.rabbitmapping, "r", encoding="utf8") as rabbitmap_fd:
rabbit_mapping = json.load(rabbitmap_fd)
r_hostlist = Hostlist(input_r["execution"]["nodelist"])
Expand Down

0 comments on commit 8fa4474

Please sign in to comment.