hashicorp / hashicorp/nomad

Grandchild jobs in the Nomad UI

Open
#24,338 0 comments 1 reaction 0 assignees View on GitHub
stage/accepted theme/ui type/enhancement
Dominant language
Go
Stars
17k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
105

Description

As pointed out in #24311, currently children of child jobs (I'll say grandchildren of grandparent jobs) are not easy to browse to in the Nomad web UI.

We brushed up against this when revamping the Jobs page ([lil breadcrumb in rpc code](https://github.com/hashicorp/nomad/blob/v1.8.0/nomad/job_endpoint_statuses.go#L243-L245)), but I don't think we wrote it down anywhere to eventually swing back around to it.

## CLI

`grandparent.nomad.hcl`:

```hcl
# `nomad job run` produces a parameterized job
job "grandparent" {
type = "batch"

# `nomad job dispatch grandparent` produces a child job
parameterized {}

# `nomad job periodic force grandparent/`
# of the child produces a periodic child,
# i.e. a "grandchild" job of the original "grandparent"
periodic {
crons = ["30 2 * * * *"] # 2:30am daily, e.g.
}

group "example" {
task "example" {
driver = "docker"
config {
image = "busybox:1"
command = "sh"
args = ["-c", "echo hello; sleep 1"]
}
}
}
}
```

```shell
$ nomad run grandparent.nomad.hcl
Job registration successful
$ nomad job dispatch grandparent
Dispatched Job ID = grandparent/dispatch-1730309121-2f3cdded
$ nomad job periodic force grandparent/
==> 2024-10-30T13:25:32-04:00: Monitoring evaluation "7e7eb01d"
2024-10-30T13:25:32-04:00: Evaluation triggered by job "grandparent/dispatch-1730309121-2f3cdded/periodic-1730309132"
2024-10-30T13:25:33-04:00: Allocation "c7540d85" created: node "4d4717d0", group "example"
2024-10-30T13:25:33-04:00: Evaluation status changed: "pending" -> "complete"
==> 2024-10-30T13:25:33-04:00: Evaluation "7e7eb01d" finished with status "complete"
$ nomad status
ID Type Priority Status Submit Date
grandparent batch/periodic/parameterized 50 running 2024-10-30T13:25:17-04:00
grandparent/dispatch-1730309121-2f3cdded batch/periodic 50 running 2024-10-30T13:25:21-04:00
grandparent/dispatch-1730309121-2f3cdded/periodic-1730309132 batch 50 dead 2024-10-30T13:25:32-04:00

```

## Web UI

The grandchild is not browse-to-able through Jobs

![Screenshot from 2024-10-30 13-29-34](https://github.com/user-attachments/assets/0b1e6939-d114-49c2-a36c-b8352981ba00)
![Screenshot from 2024-10-30 13-29-50](https://github.com/user-attachments/assets/76f0e400-5991-449a-9f11-12cd0704af16)
![Screenshot from 2024-10-30 13-30-10](https://github.com/user-attachments/assets/33547213-5bd0-456b-b708-4aa09bc35105)

Only through Evaluations (or generating the URL manually)

![Screenshot from 2024-10-30 13-30-25](https://github.com/user-attachments/assets/c9ae2929-1e11-4936-9c1d-e9cc17067a04)
![Screenshot from 2024-10-30 13-30-57](https://github.com/user-attachments/assets/1299ca8a-69d0-40be-a177-fbbebd45db50)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the breadcrumb-related code in nomad/job_endpoint_statuses.go and reproduce the grandparent, dispatched child, and periodic grandchild flow described in the issue. Trace how the Jobs page exposes those relationships and verify that the grandchild can be reached through Jobs rather than only through Evaluations or a manually constructed URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.