Skip to content

feat: jh job usage shows your compute usage against your limits - #75

Merged
lamdor merged 1 commit into
mainfrom
la/job-usage
Oct 19, 2026
Merged

lamdor merged 1 commit into
mainfrom
la/job-usage

Conversation

@lamdor

@lamdor lamdor commented Oct 16, 2026

Copy link
Copy Markdown
Member

Adds jh job usage to show your compute usage against your limits.


JuliaHub administrators can limit how many jobs a user can have active at once, and how many vCPUs and GPUs those jobs can use in total. A submission that would exceed a limit is rejected. jh job usage shows where you stand, so you, or a script using --json, can check whether a job fits before submitting it:

$ jh job usage
Compute usage on juliahub.com
  Jobs          3 of 50  (6%)
  vCPUs         960 of 1,000  (96%)
  GPUs          0 of 10

$ jh job usage --json | jq '.vcpus.limit - .vcpus.used'
40

How it works

  • It reads the new GET /api/v1/jobs/usage endpoint, which returns {"jobs", "vcpus", "gpus"}, each {"used", "limit"}.
  • Usage counts the user's submitted and running jobs; vCPUs and GPUs are the per-node count times the number of nodes. These are the same numbers the server checks at submission.
  • On a server without the endpoint, the request falls through to the job details route (GET /api/v1/jobs/{job_name}, for a job called usage) and 404s. That 404 is reported as "this JuliaHub server does not report compute usage (it needs a newer JuliaHub version)". I checked this against a current nightly, which doesn't have the endpoint yet.
  • A 403 is reported as the user not being allowed to run jobs.
  • An incomplete response is an error rather than a silent zero.
  • The percentage only appears once something is in use, and the line is marked "at limit" when the limit is reached.

The endpoint isn't in a JuliaHub release yet, so this should go out with or after the release that adds it.

Tests

  • Unit tests (usage_test.go): the request path and auth header; the 404, 403, 5xx and incomplete-response errors; the text output, including thousands separators and the at-limit marker.
  • e2e (TestJobUsageJSON): checks the --json document, and skips on instances without the endpoint.
  • go test ./..., go vet, gofmt -s and the e2e compile check all pass locally.

README and CLAUDE.md now document the command.

🤖 Posted by an AI agent · harness: Claude Code 2.1.283 · model: claude-opus-5-5
Review: reviewed by @lamdor
Session: 1c99da50-3ba3-4b10-9c46-abc0d712b4d3

JuliaHub administrators can limit how many jobs a user can have active at once, and how many vCPUs and GPUs those jobs can use in total; a submission that would exceed a limit is rejected. `jh job usage` shows where you stand, so you (or a script, with `--json`) can check whether a job fits before submitting it:

    Compute usage on juliahub.com
      Jobs          3 of 50  (6%)
      vCPUs         960 of 1,000  (96%)
      GPUs          0 of 10

It reads the new `GET /api/v1/jobs/usage` endpoint. On a server without it, the request falls through to the job details route (`GET /api/v1/jobs/{job_name}`, for a job called `usage`) and 404s; that is reported as needing a newer JuliaHub version rather than as a generic HTTP error. A 403 means the user may not run jobs at all.

Unit tests cover the request, the 404/403/5xx and incomplete-response errors and the text output; an e2e test checks the `--json` document and skips on instances without the endpoint.

Agent-Harness: Claude Code 2.1.283
Agent-Model: claude-opus-5-5
Agent-Session: 1c99da50-3ba3-4b10-9c46-abc0d712b4d3
Agent-Review: reviewed by @lamdor
@lamdor
lamdor marked this pull request as ready for review October 16, 2026 20:15
@lamdor
lamdor requested a review from a team October 16, 2026 20:15
@lamdor
lamdor merged commit 28118e6 into main Oct 19, 2026
1 check passed
@lamdor
lamdor deleted the la/job-usage branch October 19, 2026 16:47
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.

2 participants