Skip to content

cli: display job deadline if present#27913

Open
pkazmierczak wants to merge 4 commits intof-timeouts-for-batch-jobsfrom
f-timeouts-for-batch-jobs-cli
Open

cli: display job deadline if present#27913
pkazmierczak wants to merge 4 commits intof-timeouts-for-batch-jobsfrom
f-timeouts-for-batch-jobs-cli

Conversation

@pkazmierczak
Copy link
Copy Markdown
Contributor

@pkazmierczak pkazmierczak commented May 7, 2026

This changeset adds displaying the deadline (if present) to all CLI commands
that display information about jobs or allocations.

See #27803 for context.

$ nomad status maxrun
ID            = maxrun
Name          = maxrun
Submit Date   = 2026-05-07T17:33:08+02:00
Type          = batch
Priority      = 50
Datacenters   = *
Namespace     = default
Node Pool     = default
Status        = running
Periodic      = false
Parameterized = false

Summary
Task Group         Queued  Starting  Running  Failed  Complete  Lost  Unknown
huge_docker_image  0       0         0        0       1         0     0
maxrun             0       0         1        0       0         0     0

Allocations
ID        Node ID   Task Group         Version  Desired  Status    Created  Modified  Max Run Deadline
4c414d3b  9f4d1232  huge_docker_image  0        run      complete  19s ago  4s ago    2s ago
d7c16834  9f4d1232  maxrun             0        run      running   19s ago  14s ago   2m13s from now

==> View job details and metrics in the Web UI: http://127.0.0.1:4646/ui/jobs/maxrun@default

$ nomad alloc status d7c
ID                  = d7c16834-3f9a-9880-654c-4e24d0f98b7f
Eval ID             = 753fa1f9
Name                = maxrun.maxrun[0]
Node ID             = 9f4d1232
Node Name           = piotrkazmierczak-WWQLTFG2KP
Job ID              = maxrun
Job Version         = 0
Client Status       = running
Client Description  = Tasks are running
Desired Status      = run
Desired Description = <none>
Created             = 57s ago
Modified            = 52s ago
Max Run Deadline    = 1m35s from now

Task "maxrun3" (prestart) is "dead"
Task Resources:
CPU        Memory           Disk     Addresses
0/100 MHz  1.1 MiB/300 MiB  300 MiB

Task Events:
Started At     = 2026-05-07T15:33:08Z
Finished At    = 2026-05-07T15:33:10Z
Total Restarts = 0
Last Restart   = N/A

Recent Events:
Time                       Type        Description
2026-05-07T17:33:10+02:00  Terminated  Exit Code: 0
2026-05-07T17:33:08+02:00  Started     Task started by client
2026-05-07T17:33:08+02:00  Task Setup  Building Task Directory
2026-05-07T17:33:08+02:00  Received    Task received by client

Task "maxrun" is "running"
Task Resources:
CPU        Memory           Disk     Addresses
0/100 MHz  1.1 MiB/300 MiB  300 MiB

Task Events:
Started At     = 2026-05-07T15:33:10Z
Finished At    = N/A
Total Restarts = 0
Last Restart   = N/A

Recent Events:
Time                       Type        Description
2026-05-07T17:33:10+02:00  Started     Task started by client
2026-05-07T17:33:10+02:00  Task Setup  Building Task Directory
2026-05-07T17:33:08+02:00  Received    Task received by client

Task "maxrun2" is "dead"
Task Resources:
CPU        Memory           Disk     Addresses
0/100 MHz  1.1 MiB/300 MiB  300 MiB

Task Events:
Started At     = 2026-05-07T15:33:10Z
Finished At    = 2026-05-07T15:33:12Z
Total Restarts = 0
Last Restart   = N/A

Recent Events:
Time                       Type        Description
2026-05-07T17:33:12+02:00  Terminated  Exit Code: 0
2026-05-07T17:33:10+02:00  Started     Task started by client
2026-05-07T17:33:10+02:00  Task Setup  Building Task Directory
2026-05-07T17:33:08+02:00  Received    Task received by client

==> View allocation details in the Web UI: http://127.0.0.1:4646/ui/allocations/d7c16834-3f9a-9880-654c-4e24d0f98b7f

@pkazmierczak pkazmierczak requested a review from schmichael May 7, 2026 08:05
@pkazmierczak pkazmierczak self-assigned this May 7, 2026
@pkazmierczak pkazmierczak requested a review from a team as a code owner May 7, 2026 08:05
@pkazmierczak pkazmierczak requested a review from a team as a code owner May 7, 2026 08:05
@pkazmierczak pkazmierczak added this to the 2.0.1 milestone May 7, 2026
@pkazmierczak pkazmierczak force-pushed the f-timeouts-for-batch-jobs branch from e34dbc9 to d3798f1 Compare May 7, 2026 15:36
Before:
```
$ nomad alloc status -verbose 8a24f147-9055-a2cb-8ede-b852466f35a1
ID                  = 8a24f147-9055-a2cb-8ede-b852466f35a1
...
Created             = 2026-05-07T12:10:30-07:00
Modified            = 2026-05-07T12:10:40-07:00
Max Run Deadline    = 2026-05-07T19:10:40Z
```

After:
```
$ nomad alloc status -verbose 1d02ae9b-636e-ec2e-33ec-a0d1083aa6e9
ID                  = 1d02ae9b-636e-ec2e-33ec-a0d1083aa6e9
...
Created             = 2026-05-07T12:23:41-07:00
Modified            = 2026-05-07T12:23:42-07:00
Max Run Deadline    = 2026-05-07T22:23:41-07:00
```
Comment thread command/helpers.go
return time.Time{}, false
}

return latest.Local(), true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed this because I noticed the timezone wasn't localized in verbose output (like it is for created and modified timestamps). From the commit message:

4f2a58b

display max run duration in local tz

Before:
```
$ nomad alloc status -verbose 8a24f147-9055-a2cb-8ede-b852466f35a1
ID                  = 8a24f147-9055-a2cb-8ede-b852466f35a1
...
Created             = 2026-05-07T12:10:30-07:00
Modified            = 2026-05-07T12:10:40-07:00
Max Run Deadline    = 2026-05-07T19:10:40Z
```

After:
```
$ nomad alloc status -verbose 1d02ae9b-636e-ec2e-33ec-a0d1083aa6e9
ID                  = 1d02ae9b-636e-ec2e-33ec-a0d1083aa6e9
...
Created             = 2026-05-07T12:23:41-07:00
Modified            = 2026-05-07T12:23:42-07:00
Max Run Deadline    = 2026-05-07T22:23:41-07:00
```

Copy link
Copy Markdown
Member

@schmichael schmichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I pushed a tiny localization fix I noticed when playing with it locally. Hopefully didn't break the tests. 😬

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants