flux-core icon indicating copy to clipboard operation
flux-core copied to clipboard

libjob: add infrastructure for non-integer counts

Open sam-maloney opened this issue 7 months ago • 1 comments

Problem: non-integer counts from RFC 14 are largely unsupported in flux-core.

This PR adds some initial infrastructure as a first step towards enabling non-integer counts; N.B. at present the new code is not actually used to do anything, this PR only includes the new struct definitions along with creation, encoding/decoding, and iteration functions (as well as initial unit testing).

The count wrapper structs are intended to present a similar interface (albeit a limited subset thereof) as libidset, particularly since flux-framework/rfc#442 proposes allowing counts to be given as idsets (which this PR implements). The iteration functions therefore intend to allow code to be agnostic to which type of count was actually given (integer, idset, or range). Any feedback on the design, etc. would be much appreciated!

The string representation for decoding/encoding of ranges is documented in the proposed RFC 45 at flux-framework/rfc#453

In conjunction with #6705 this will then allow non-integer ranges to be enabled in more parts of the code, such as job-listing, sched-simple, etc.

sam-maloney avatar May 22 '25 06:05 sam-maloney

I do wonder if counts.[ch] belong in libutil, but for now libjob actually does seem a bit more appropriate and it could always be moved.

I definitely wasn't sure at all where best to put this, but since it grew from the parsing of jobspec in the shell init, which uses jj, I stuck the new code in libjob as well...

sam-maloney avatar Jun 30 '25 13:06 sam-maloney

Codecov Report

:x: Patch coverage is 98.54369% with 3 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 83.88%. Comparing base (3323cf0) to head (807f789). :warning: Report is 669 commits behind head on master.

Files with missing lines Patch % Lines
src/common/libjob/count.c 98.54% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6832      +/-   ##
==========================================
+ Coverage   83.83%   83.88%   +0.04%     
==========================================
  Files         539      540       +1     
  Lines       90283    90489     +206     
==========================================
+ Hits        75693    75905     +212     
+ Misses      14590    14584       -6     
Files with missing lines Coverage Δ
src/common/libjob/count.c 98.54% <98.54%> (ø)

... and 4 files with indirect coverage changes

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

codecov[bot] avatar Oct 10 '25 14:10 codecov[bot]