Skip to content

return effective queue config in job-manager.queue-list and use it in flux resource - #7772

Open
grondo wants to merge 10 commits into
flux-framework:masterfrom
grondo:qlist-enhance
Open

return effective queue config in job-manager.queue-list and use it in flux resource#7772
grondo wants to merge 10 commits into
flux-framework:masterfrom
grondo:qlist-enhance

Conversation

@grondo

@grondo grondo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

This PR updates the job-manager.queue-list RPC to include the effective queue configuration in a new conf object, as a first step in making the job-manager the authoritative source for current queue configuration. Adding queue policy to the response is deferred to keep the PR reviewable, so only one consumer - flux-resource.py - is updated to use conf, which drops its need to read the [queues] table directly.

The updated response includes a new conf object next to the existing queues object. The conf object currently contains a single queues key - an array of queue configuration objects, e.g.:

{"queues": [{"name:s", "requires?s", "parent?s"},  ...}.

Other details of interest:

  • "Effective" config means a vqueue's requires is copied from its parent, so clients stop re-deriving inherited fields from [queues]. Policy inheritance will follow.
  • Ordering: conf preserves config declaration order, matching the ordering clients got when reading [queues] directly.
  • Caching: the response is cached and rebuilt lazily, since it only changes on reconfig
  • Backward compatibility: flux resource falls back to reading [queues] from config directly if it is talking to an older job-manager that doesn't supply the conf object in its response.

grondo added 10 commits August 12, 2026 09:36
Problem: The multi-line comments on the 'requires' and 'parent' fields
of struct queue are indented one space past the opening slash, so the
comments do not properly align.

Align the continuation stars with the opening comment.

Assisted-by: Claude:Opus-4.8
Problem: The queue-list RPC returns queue names in arbitrary hash
order, so tools cannot present queues reproducibly, and there is no
ordered structure to build a richer response on.

Maintain a zlistx of named queues alongside the hash, re-sequenced to
config declaration order at the end of each reconfigure, and encode the
name list from it. The list holds borrowed pointers with per-queue
handles for O(1) removal, and is structured so future runtime queues
can be appended after the static queues.

Assisted-by: Claude:Opus-4.8
Problem: The new config-declaration ordering of the queue name list is
not exercised by the unit tests, so a regression in the reorder logic
would go unnoticed.

Add test_list_order() covering initial declaration order and reloads
that reorder, add, remove, combine all three, drop to anon mode, and
re-enter named mode.

Assisted-by: Claude:Opus-4.8
Problem: Components that need a queue's effective configuration re-read
the [queues] table and re-derive inherited fields client-side, so the
job-manager is not the authority on queue configuration.

Add a "conf" object to the queue-list response carrying each queue's
effective configuration ({name, requires, parent}) in declaration
order, so consumers can stop re-deriving it. A virtual queue's requires
is inherited from its parent. The conf object is an object, not a bare
array, leaving room for future global fields.

Assisted-by: Claude:Opus-4.8
Problem: The new conf object in the queue-list response, including its
ordering and virtual-queue requires inheritance, has no test coverage.

Add a queues_list_response() unit test asserting the conf shape,
declaration order, and effective requires/parent, and extend the
t0034-queuelist Python test to check the conf object over the wire,
including a reconfigure that re-sequences queues.

Assisted-by: Claude:Opus-4.8
Problem: The queue-list response will be fetched by many components but
changes rarely, so rebuilding it on every request is wasted work.

Cache the assembled response in the queues object, rebuilding it lazily
and invalidating it from notify() on any mutation. queues_list_response()
now returns a borrowed reference owned by the cache. Since notify() is
the single choke point for every mutation, no change can bypass
invalidation.

The existing test_list_response() decref'd the return value, which is
now owned by the cache, so those decrefs are removed here to keep the
test correct.

Assisted-by: Claude:Opus-4.8
Problem: The response caching added to queues_list_response() has no
test asserting the cache is reused when unchanged and dropped on a
mutation.

Assert that a second call with no intervening mutation returns the same
object, and that a queue mutation causes a fresh object to be built.

Assisted-by: Claude:Opus-4.8
Problem: Clients that read the [queues] config to derive a queue's
effective requires re-implement RFC 33 virtual-queue parent inheritance,
and there is no shared way to produce the job-manager.queue-list "conf"
object from a raw config.

Add queue_conf_from_config(), which builds the "conf" object from a raw
broker config in declaration order, resolving a virtual queue's requires
from its parent. It backs the fallback path for older job-managers that
predate the "conf" object and the hidden --config-file/--from-stdin test
options.

Assisted-by: Claude:Opus-4.8
Problem: flux-resource reads the [queues] config directly and re-derives
each queue's effective requires, duplicating the RFC 33 virtual-queue
parent inheritance that the job-manager already performs, so it is not
the authority on queue configuration.

Take the effective queue config from the job-manager.queue-list "conf"
object instead. An older job-manager without "conf" and the hidden
--config-file/--from-stdin test options fall back to deriving it locally
via queue_conf_from_config(). This removes the client-side
queue_effective_entry() resolver.

Assisted-by: Claude:Opus-4.8
Problem: The new queue_conf_from_config() helper and its use as the
authoritative queue config source for flux-resource have no test
coverage, and nothing guards the helper against drifting from the
job-manager's "conf" encoding.

Add t0049-queue-conf.py unit tests for the helper (declaration order,
effective requires, virtual-queue inheritance, and fail-closed on an
unconfigured parent), and add a t0034 case asserting the helper
reproduces the live queue-list "conf" object exactly.

Assisted-by: Claude:Opus-4.8
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.47020% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.84%. Comparing base (7660360) to head (fdfef8f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/modules/job-manager/queues.c 66.30% 31 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7772      +/-   ##
==========================================
- Coverage   83.86%   83.84%   -0.02%     
==========================================
  Files         599      599              
  Lines      102321   102414      +93     
==========================================
+ Hits        85808    85874      +66     
- Misses      16513    16540      +27     
Files with missing lines Coverage Δ
src/bindings/python/flux/queue.py 98.64% <100.00%> (+0.16%) ⬆️
src/cmd/flux-resource.py 95.39% <100.00%> (+0.92%) ⬆️
src/modules/job-manager/queue.c 81.65% <100.00%> (+0.16%) ⬆️
src/modules/job-manager/queues.c 78.60% <66.30%> (-1.90%) ⬇️

... and 14 files with indirect coverage changes

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

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.

1 participant