Repository navigation
add flux adapter - #1037
Open
Oglopf wants to merge 3 commits into
Open
add flux adapter#1037Oglopf wants to merge 3 commits into
Oglopf wants to merge 3 commits into
Conversation
Matches the other adapters since #1014: the Flux adapter passes native straight to flux batch, so it takes a list, and anything else now gets the same clear JobAdapterError instead of failing later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Oglopf
force-pushed
the
add-flux-adapter
branch
from
October 9, 2026 17:31
87d0500 to
06d26c5
Compare
johrstrom
reviewed
Oct 14, 2026
|
|
||
| # Object used for simplified communication with Flux | ||
| # @api private | ||
| class Batch |
Contributor
There was a problem hiding this comment.
I wonder if it's better to split these files up? I always get sort of lost looking at slurm with everything in one file.
Contributor
Author
There was a problem hiding this comment.
Haha, same and I agree. Split Batch into flux/batch.rb and JobId into flux/job_id.rb, same layout as the LSF and SGE adapters. flux.rb is now just the factory and the adapter. I left the info parsing in flux.rb so the adapter methods sit next to what they return, but happy to pull that out too if you’d rather. And looking at what was recently done with Slurm maybe I should just go ahead and do that actually.
Following review, and the layout the LSF and SGE adapters use: - flux/batch.rb: Batch, which runs the flux CLI and parses its JSON - flux/job_id.rb: JobId, the F58 to decimal conversion - flux.rb: the factory and the adapter (submit, info, state mapping) A pure move: constant names are unchanged, so callers and tests are untouched. The split files use the compact class form, like lsf/batch.rb, and are required from inside the Flux class body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a native job adapter for Flux (
adapter: "flux"), for sites that run Flux as their system scheduler. Today the only route is the PSI/J adapter with a Flux executor, which needs Python and the Flux bindings on the submit host and hides Flux-specific job detail.It's built on the
fluxCLI:submitflux batch(script on stdin)info,statusflux jobs --json IDinfo_all/info_where_ownerflux jobs --json -A/-u USERhold/releaseflux job urgency ID hold/defaultdeleteflux cancel IDSupports job dependencies (
aftermaps toafterstart). No job arrays: submitting one raises instead of being silently ignored.Related issue
Closes #1035
Testing
50 minitests in
test/job/adapters/flux_test.rb. Theflux jobs --jsonfixtures are real output from flux-core 0.89.0 (fluxrm/flux-sched) for running, held, pending, time-limited and canceled jobs, plus the real error text for unknown job IDs. Several behaviors below were checked by hand against that instance and are noted in the tests.Checklist
Docs for the adapter config (
bin,bin_overrides,submit_host,strict_host_checking,flux_uri) will follow in ood-documentation.Anything else?
Things worth a close look:
Job IDs are returned in decimal. Flux prints F58 IDs (
ƒiFkbMhFM) by default, which don't belong in URLs, file paths or batch connect session files. The decoder is checked against real ID pairs, and everyfluxcommand accepts decimal as input.Output is treated as UTF-8 regardless of locale. F58 IDs appear in error messages too (
ƒ68GN: unknown job id). Under a C locale, matching that text raisedArgumentError, sodeleteon an unknown job crashed instead of being ignored. Same class of fix as the Slurm adapter's UTF-8 change in force utf-8 encoding #842.One slot by default.
flux batchrefuses to submit without a size, so the adapter adds-n 1unlesscoresor native args (-N,-n,--nodes,--nslots) already size the job.The environment, the main design decision. Flux copies the whole submit environment by default, so with
copy_environmentunset the adapter clears it with--env=-*, matching what other adapters do. Checked against a real instance, that leaves jobs with noHOME,USERorPATH, and a#!/bin/bash -llogin shell doesn't bringPATHback. Slurm avoids this because--export=NONEimplies--get-user-env; Flux has no equivalent. So, following the Kubernetes adapter'sdefault_env, the adapter sets:USER,LOGNAME,HOMEandSHELLfrom the user database (not the PUN's environment)PATH, with the configuredbin:directory first soflux runworks inside batch scriptsjob_environmentoverrides any of these. Open question for Flux sites: is a fixed systemPATHright, or do sites expect something from their own job shell config?User lookup is by uid, not
Etc.getlogin. The Kubernetes adapter usesgetlogin, which can return nil in a process with no terminal, like a PUN. That's possibly a latent issue there, out of scope here.Not yet covered by real output: FAILED and TIMEOUT results (the test instance had one node, so those jobs stayed queued), and multi-job
info_alloutput. The{"jobs": [...]}wrapper is confirmed against real output, but the test assembles its jobs from single-job fixtures. Both get replaced by recordings oncescheduler_recordingshas a Flux backend.Out of scope for v1:
cluster_info, per-job GPU counts (would needflux job info ID Rper job), job arrays, and Flux instances nested inside another scheduler's allocation.🤖 Generated with Claude Code