Discuss MVP job-control and resource-listing endpoints (submit, list, status, state, cancel, output, nodes).
Note: Generated with assistance from Claude, leveraging some ideas from the existing flux-restful-apis repo by @vsoch. May contain some mistakes that we can fix.
Problem
flux-rest-server currently has no job-control surface (only /api/v1/ and
/api/v1/health). This issue proposes a minimal set of endpoints covering the
job lifecycle — submit, list, inspect, poll, cancel, output — plus a
cluster resource-listing endpoint, each backed by a real, existing Flux
Python API call.
Proposed endpoints
| Method |
Path |
Purpose |
Backing Flux API |
POST |
/api/v1/jobs/submit |
Submit a job |
flux.job.submit() (jobspec via JobspecV1.from_command()) |
GET |
/api/v1/jobs/list |
List jobs |
flux.job.list.JobList() |
GET |
/api/v1/jobs/<id> |
Full job info |
flux.job.list.job_list_id() |
GET |
/api/v1/jobs/<id>/state |
Cheap state-only poll |
job_list_id(attrs=["state","result"]) |
POST |
/api/v1/jobs/<id>/cancel |
Cancel a job |
flux.job.cancel() |
GET |
/api/v1/jobs/<id>/output |
Get stdout/stderr |
flux.job.output.job_output() |
GET |
/api/v1/nodes/list |
List cluster nodes/resources |
flux.resource.list.resource_list() → SchedResourceList |
Notes:
/state has no flux-restful-api equivalent — added to give guest callers a
cheap poll target. Jobs must be submitted with the waitable flag to be
usable with flux.job.wait(), and only the instance owner may submit jobs
with that flag — so guest callers can't rely on blocking waits and need to
poll instead.
- Cancel uses
POST .../cancel, matching flux-restful-api's convention within
the same Flux ecosystem. (SLURM's slurmrestd instead cancels via
DELETE job/{job_id}, optionally with a signal param — noted here in case
that precedent is worth revisiting later, e.g. for signal delivery.)
/output is a separate endpoint (not folded into status) so routine polling
doesn't have to drag along potentially large output data.
/nodes mirrors flux-restful-api's GET /v1/nodes. Backed by
resource_list(), an async call whose future resolves (via .get()) to a
SchedResourceList with .up/.free/.down/.allocated resource sets
(the same data flux resource list displays) — useful for clients that
want capacity info before submitting.
References
Discuss MVP job-control and resource-listing endpoints (submit, list, status, state, cancel, output, nodes).
Note: Generated with assistance from Claude, leveraging some ideas from the existing
flux-restful-apisrepo by @vsoch. May contain some mistakes that we can fix.Problem
flux-rest-servercurrently has no job-control surface (only/api/v1/and/api/v1/health). This issue proposes a minimal set of endpoints covering thejob lifecycle — submit, list, inspect, poll, cancel, output — plus a
cluster resource-listing endpoint, each backed by a real, existing Flux
Python API call.
Proposed endpoints
POST/api/v1/jobs/submitflux.job.submit()(jobspec viaJobspecV1.from_command())GET/api/v1/jobs/listflux.job.list.JobList()GET/api/v1/jobs/<id>flux.job.list.job_list_id()GET/api/v1/jobs/<id>/statejob_list_id(attrs=["state","result"])POST/api/v1/jobs/<id>/cancelflux.job.cancel()GET/api/v1/jobs/<id>/outputflux.job.output.job_output()GET/api/v1/nodes/listflux.resource.list.resource_list()→SchedResourceListNotes:
/statehas noflux-restful-apiequivalent — added to give guest callers acheap poll target. Jobs must be submitted with the
waitableflag to beusable with
flux.job.wait(), and only the instance owner may submit jobswith that flag — so guest callers can't rely on blocking waits and need to
poll instead.
POST .../cancel, matchingflux-restful-api's convention withinthe same Flux ecosystem. (SLURM's
slurmrestdinstead cancels viaDELETE job/{job_id}, optionally with asignalparam — noted here in casethat precedent is worth revisiting later, e.g. for signal delivery.)
/outputis a separate endpoint (not folded into status) so routine pollingdoesn't have to drag along potentially large output data.
/nodesmirrorsflux-restful-api'sGET /v1/nodes. Backed byresource_list(), an async call whose future resolves (via.get()) to aSchedResourceListwith.up/.free/.down/.allocatedresource sets(the same data
flux resource listdisplays) — useful for clients thatwant capacity info before submitting.
References
flux.job.Jobspec(from_commandsignature): https://flux-framework.readthedocs.io/projects/flux-core/en/latest/python/autogenerated/flux.job.Jobspec.htmlflux.job.list(JobList,job_list_id): https://flux-framework.readthedocs.io/projects/flux-core/en/latest/python/autogenerated/flux.job.list.htmlflux.job.kill(cancel,kill): https://flux-framework.readthedocs.io/projects/flux-core/en/latest/python/autogenerated/flux.job.kill.htmlflux.job.output(job_output,output_watch*): https://flux-framework.readthedocs.io/projects/flux-core/en/latest/python/autogenerated/flux.job.output.htmlflux.resource.list(resource_list,SchedResourceList): https://flux-framework.readthedocs.io/projects/flux-core/en/stable/python/autogenerated/flux.resource.list.html