Skip to content

[WIP] shell: select task command from scheduler-matched slot label - #7799

Open
zekemorton wants to merge 2 commits into
flux-framework:masterfrom
zekemorton:xor-tasks
Open

[WIP] shell: select task command from scheduler-matched slot label#7799
zekemorton wants to merge 2 commits into
flux-framework:masterfrom
zekemorton:xor-tasks

Conversation

@zekemorton

@zekemorton zekemorton commented Sep 2, 2026

Copy link
Copy Markdown

Summary

This PR adds the flux-core shell support needed to select a task command based on the slot alternative
matched by the scheduler.

It complements flux-sched#1550, which records the
matched flexible-slot label in the scheduler’s R metadata. Together, the changes allow a jobspec with
multiple tasks[] entries—each associated with a tasks[].slot label—to run the command corresponding to
the resource alternative selected at scheduling time.

Implementation

  • Preserve the complete jobspec tasks array during shell parsing, instead of retaining only tasks[0].
  • Continue to use tasks[0] as the default command for ordinary single-task jobspecs.
  • Read the current broker rank’s matched slot label from:
    scheduling.graph.nodes[].metadata.ephemeral.slot_label
    in R.
  • Resolve job->command to the task whose slot matches that label before tasks are created. This means
    existing consumers of job->command, including task argv construction and the default job name,
    automatically use the selected command.
  • Fail clearly if R identifies a slot label for which the jobspec has no task.
  • Reject conflicting labels for resources allocated to the same rank, since the shell currently selects one
    command per rank.

Compatibility

Jobs without labeled task alternatives are unchanged:

  • Single-task jobspecs continue to run tasks[0].
  • Jobs scheduled with an R match format that does not include scheduling metadata, such as rv1_nosched,
    also retain the tasks[0] default.

Testing

Adds unit coverage for multi-task jobspec parsing and command resolution, including:

  • default selection of tasks[0];
  • NULL and empty labels;
  • matching labels selecting the corresponding command; and
  • unknown labels returning an error.

Flux-sched companion PR here

Zeke Chadron Blair Morton added 2 commits September 2, 2026 16:38
Problem: Multi-task jobspecs bind commands to slot labels, but the
shell only retains tasks[0], so it cannot select the matched task.

Retain the tasks array and resolve the command for a supplied slot
label, preserving the tasks[0] default. Add resolution tests.

Assisted-by: Claude:claude-opus-4.8
Problem: The shell resolves task commands by slot label but does not read the label assigned to its rank by the scheduler.

Read the rank's slot label from R scheduling metadata and use it to resolve the command. Keep the tasks[0] default when no label exists.

Assisted-by: Claude:claude-opus-4.8
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 56.00000% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.82%. Comparing base (f4d31d9) to head (7e6350a).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/shell/info.c 35.48% 20 Missing ⚠️
src/shell/jobspec.c 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7799      +/-   ##
==========================================
- Coverage   83.84%   83.82%   -0.02%     
==========================================
  Files         599      599              
  Lines      102687   102737      +50     
==========================================
+ Hits        86099    86123      +24     
- Misses      16588    16614      +26     
Files with missing lines Coverage Δ
src/shell/jobspec.c 96.05% <89.47%> (-0.94%) ⬇️
src/shell/info.c 72.53% <35.48%> (-7.10%) ⬇️

... and 11 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@grondo

grondo commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

We should get an issue open against RFC 20 (Rv1) to add the slot label. This would remove the need for the job shell to reach into an opaque, scheduler-specific scheduling key for this data.

Once the RFC 20 changes are merged, this PR could be updated and perhaps one of the Python schedulers or a test scheduler could be developed to emit the slot label in R for more complete end-to-end testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants