Skip to content

MVP job-control and resource-listing endpoints #6

Description

@tpatki

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions