Skip to content

Commit

Permalink
Merge pull request #5730 from grondo/issue#5723
Browse files Browse the repository at this point in the history
shell: generate fatal error if `block` taskmap scheme has an argument
  • Loading branch information
mergify[bot] committed Feb 14, 2024
2 parents 5fe073b + 9161029 commit 35c2c10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/shell/shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1337,9 +1337,17 @@ static int shell_taskmap (flux_shell_t *shell)
shell_log_error ("failed to parse taskmap shell option");
return -1;
}
if (rc == 0
|| streq (scheme, "block"))
if (rc == 0)
return 0;
if (streq (scheme, "block")) {
/* A value is not allowed for the block taskmap scheme:
*/
if (strlen (value) > 0)
shell_die (1,
"block taskmap does not accept a value (got %s)",
value);
return 0;
}

shell_trace ("remapping tasks with scheme=%s value=%s",
scheme,
Expand Down
4 changes: 4 additions & 0 deletions t/t2616-job-shell-taskmap.t
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ test_expect_success 'taskmap is unchanged with --taskmap=block' '
| jq -e ".context.taskmap.map == [[0,4,4,1]]" &&
test_check_taskmap $id
'
test_expect_success 'shell dies with --taskmap=block:oops' '
test_must_fail_or_be_terminated flux run -N4 --tasks-per-node=4 \
--taskmap=block:oops ./map.sh
'
test_expect_success 'taskmap is correct for --tasks-per-node=2' '
id=$(flux submit -N4 --tasks-per-node=2 ./map.sh) &&
flux job wait-event -p guest.exec.eventlog -f json $id shell.start &&
Expand Down

0 comments on commit 35c2c10

Please sign in to comment.