Skip to content
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

Show last job status in UI in jobs list #23893

Open
trgtrg opened this issue Aug 29, 2024 · 3 comments
Open

Show last job status in UI in jobs list #23893

trgtrg opened this issue Aug 29, 2024 · 3 comments

Comments

@trgtrg
Copy link

trgtrg commented Aug 29, 2024

Proposal

Show last run status - succeeded or failed.

Use-cases

I have 100 periodic batch jobs and I want to see in one list if they all are working fine.

Attempted Solutions

failed or not
@philrenaud
Copy link
Contributor

@trgtrg This is an awesome suggestion, thank you. I'll look into it, or if you or anybody else are interested, this would be a great issue to tackle.

@TheInvincibleRalph
Copy link

Hi, @philrenaud. I am interested in taking this but could you give more context as to what to do?

@philrenaud
Copy link
Contributor

@TheInvincibleRalph Yeah! We did a pretty big overhaul to the jobs index page a few months ago: you can find @gulducat 's excellent work on it over at #20130 (and the UI parts at #20452)

You may note that there's a ChildStatuses property (https://github.com/hashicorp/nomad/pull/20130/files#diff-a3d5151e4786eb7bf28475ee38f9094f588edd49dd718c4f989d547902773eceR232-R250) for when a job has child jobs (if it's a parameterized or periodic job type)

This gives us a little information, but not enough to make this feature really useful: this is because Job.Status gives us a pretty limited set of information: a job can be Dead, Running, or Pending (see https://github.com/hashicorp/nomad/blob/main/nomad/structs/structs.go#L4298-L4302)

The way we've started deriving more user-friendly statuses like "Complete" or "Failed", etc. is by looking that job's allocations: specifically if the job's total groups' count worth of allocations all have statuses that indicate things have gone well (see possible allocation statuses here: https://github.com/hashicorp/nomad/blob/main/nomad/structs/structs.go#L10903-L10910)

If one could do something like:

  • get the latest job among child jobs for a given periodic/parameterized job,
  • grab the allocations from that child job and surface them in a new property like lastJobAllocations, in the same format that you see for top-level jobs at the /statuses endpoint,

...then we could run them through the UI's aggregateAllocStatus() getter, which surfaces a user-friendly status that would be nice to append here.

(the final part of this would be to surface that information in the jobs index table where this is some prior art for using Hds::Badges for this)

So: a couple steps, but this is a pretty neat feature with some fairly recent code paths!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

3 participants