-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 preemptions in nomad plan CLI #4823
Conversation
5ab6674
to
0ff5d01
Compare
for _, alloc := range resp.Annotations.PreemptedAllocs { | ||
allocs = append(allocs, fmt.Sprintf("%s|%s|%s", alloc.ID, alloc.JobID, alloc.TaskGroup)) | ||
} | ||
c.Ui.Output(formatList(allocs)) |
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.
[nit] Feel free to return early here and remove else
. It would reduce nesting and make the big else clause easier to follow.
command/job_plan_test.go
Outdated
@@ -7,8 +7,12 @@ import ( | |||
"strings" | |||
"testing" | |||
|
|||
"strconv" |
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.
goimport misformatting
command/job_plan_test.go
Outdated
"github.com/hashicorp/nomad/testutil" | ||
"github.com/mitchellh/cli" | ||
require2 "github.com/stretchr/testify/require" |
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.
require2?
788e813
to
1d7ebb9
Compare
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. |
This PR augments the output of
nomad plan
with info about preemptions.It uses a tiered approach to make sure the CLI doesn't show every single allocid if there are many preemptions. Instead, it groups things and shows summary counts.
There are three cases:
1 - Number of preempted allocations less than 10
2 - Number of unique jobids amongst all preemptions less than 10
3 - Number of unique jobids amongst all preemptions greater than 10
Builds on top of #4794, which should be merged first.