-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New API endpoint to back UI jobs index page uplift #20130
Conversation
b86c394
to
6218d2a
Compare
03fcc80
to
7afc007
Compare
01f7d8c
to
b681e8b
Compare
example usage: ``` $ cat jobs.json { "jobs": [ {"id": "clients", "namespace": "default"}, {"id": "fail"} ] } $ cat jobs.json | nomad operator api -X POST /v1/jobs/statuses | jq . ```
with ?index= query param e.g. ``` $ cat jobs.json | nomad operator api -X POST /v1/jobs/statuses?index=1681 | jq . ```
will need to read response headers for index, next_token
This reverts commit 3e0ab67.
in favor of LatestDeployment which has more info
* add ability to include them at all: ?include_children=true * add ParentID to UIJob response, so they can be associated with the parent job * for parent jobs, ChildStatuses should always be an array, rather than nil (null)
7d819dd
to
cb8a211
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @gulducat!
I've left a few minor comments, but the only one that really raises an eyebrow is the flaky test warning. I'd be open to fixing that in a separate PR though. Also, we'll need to add API docs. That can be a separate PR as well.
// ostensibly GETs should not accept structured body, but the HTTP spec | ||
// on this is more what you'd call "guidelines" than actual rules. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆
// this little cutie sets the latest state index to a predictable value, | ||
// to ensure the below jobs span the boundary from 999->1000 which would | ||
// break pagination without proper uint64 NextToken (ModifyIndex) comparison | ||
must.NoError(t, s.State().UpsertNamespaces(996, nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clever, and good explanatory comment! 👍
my own subtest naming inconsistency was making me twitchy
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Introduce a new API
/v1/jobs/statuses
, primarily for use in the UI, that collates info about jobs, their allocations, and latest deployment.Closes #19339 ; UI changes that use it for
/ui/jobs
page: #20452Some of noteworthy tidbits:
?filter=
s apply tostructs.Job
(i.e. one can not filter based on allocs or such)/v1/jobs
, then sorts client-side, but we're introducing pagination here, so less efficient in one sense, but more efficient in anotherHopefully tests and code comments cover the rest of the nuances.
I'm leaving the whole messy commit history for posterity, but will squash on merge!