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

[cli] Adds Actions to job status command output #24959

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

philrenaud
Copy link
Contributor

Provides a little table showing Nomad Actions available to a job when running nomad job status $jobid. Mimics what we show in the Web UI (where there's an Actions dropdown on the main page of jobs that have 'em)

nomad job status actions-demo-service
ID            = actions-demo-service
Name          = actions-demo-service
Submit Date   = 2025-01-23T16:13:22-05:00
Type          = service

Summary
Task Group  Queued  Starting  Running  Failed  Complete  Lost  Unknown
actionless  0       0         3        0       16        0     0
group1      0       0         1        0       7         0     0
group2      0       0         6        0       25        0     0

.....

Actions
Action Name     Task Group  Task
weather         group1      task
get-alloc-info  group1      task
echo-time       group1      task
get-alloc-info  group2      task
echo-time       group2      task

.....

Allocations
ID        Node ID   Task Group  Version  Desired  Status   Created    Modified
13ab36c1  c1b3d83b  actionless  6        run      running  3d20h ago  3d20h ago
5125fdda  c1b3d83b  group1      6        run      running  3d20h ago  3d20h ago
664ec7e8  c1b3d83b  group2      6        run      running  3d20h ago  3d20h ago

command/job_status.go Outdated Show resolved Hide resolved
command/job_status.go Outdated Show resolved Hide resolved
website/content/docs/commands/status.mdx Outdated Show resolved Hide resolved
Copy link
Member

@gulducat gulducat left a comment

Choose a reason for hiding this comment

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

lgtm!

parts := strings.Split(action, "|")
if len(parts) != 3 {
group, task, actionName := action["group"], action["task"], action["action"]
if group == "" || task == "" || actionName == "" {
Copy link
Member

Choose a reason for hiding this comment

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

seems weird these may be empty. and could any of them be empty without all of them being empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You know, I think group/task can never be empty, and we explicitly guard against actionName being empty too. Maybe this is an unreachable condition?

@philrenaud philrenaud added the backport/1.9.x backport to 1.9.x release line label Feb 3, 2025
@philrenaud philrenaud merged commit 9367929 into main Feb 4, 2025
35 checks passed
@philrenaud philrenaud deleted the f-ui/job-status-command-with-actions branch February 4, 2025 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.9.x backport to 1.9.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants