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: job restart command #16278

Merged
merged 27 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
40ad9b0
cli: job restart command
shishir-a412ed Oct 13, 2021
fe21b04
docs: nomad job restart command
lgfa29 Feb 28, 2023
b2551ae
changelog: add entry for #16278
lgfa29 Mar 1, 2023
5fd74ae
address some code review
lgfa29 Mar 1, 2023
47abdf9
remove random leftover code
lgfa29 Mar 1, 2023
bbfe271
address more code review changes
lgfa29 Mar 2, 2023
2c23e7a
cli: make job restart error messages more consistent
lgfa29 Mar 2, 2023
164e233
cli: refactor alloc reschedule with job restart
lgfa29 Mar 2, 2023
cf37b69
docs: clarify the difference between restart and reschedule for `noma…
lgfa29 Mar 2, 2023
f94864a
cli: fix return order for job restart CLI flag parse and validation
lgfa29 Mar 3, 2023
7c7e748
cli: handle job versions
lgfa29 Mar 3, 2023
7e3ebf1
Merge remote-tracking branch 'origin/main' into f-job-restart-cmd
lgfa29 Mar 3, 2023
9552e09
cli: use the alloc stop index for monitoring state
lgfa29 Mar 4, 2023
b0cc123
cli: fix job restart placement failure monitoring
lgfa29 Mar 4, 2023
971ec5d
cli: add job prefix matching to job restart
lgfa29 Mar 4, 2023
7ccde09
cli: add -yes flag and ask user for confirmation when restarting mult…
lgfa29 Mar 4, 2023
83e5ace
cli: make Meta.Ui a *cli.ConcurrentUi instead of using another ui
lgfa29 Mar 4, 2023
8bd184b
test: fix tests for job restart command
lgfa29 Mar 4, 2023
1e34a04
improve error handling
lgfa29 Mar 15, 2023
939d645
fix handling of interrupt signal
lgfa29 Mar 15, 2023
6e9b8be
Merge remote-tracking branch 'origin/main' into f-job-restart-cmd
lgfa29 Mar 15, 2023
93c35fb
update ACL
lgfa29 Mar 15, 2023
8cdcc14
last touches
lgfa29 Mar 16, 2023
e53fbe0
cli: fix panic on Meta.Colorize
lgfa29 Mar 17, 2023
810800b
cli: use os.Interrupt instead of syscall.SIGINT
lgfa29 Mar 17, 2023
fde22d6
cli: fix follow-up alloc monitoring
lgfa29 Mar 17, 2023
069d2c6
cli: prevent job restart if there is an active deployment
lgfa29 Mar 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/16278.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
cli: Added new `nomad job restart` command to restart all allocations for a job
```
6 changes: 6 additions & 0 deletions api/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,12 @@ func (t *Task) SetLogConfig(l *LogConfig) *Task {
return t
}

// SetLifecycle is used to set lifecycle config to a task.
func (t *Task) SetLifecycle(l *TaskLifecycle) *Task {
t.Lifecycle = l
return t
}

// TaskState tracks the current state of a task and events that caused state
// transitions.
type TaskState struct {
Expand Down
5 changes: 5 additions & 0 deletions command/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,11 @@ func Commands(metaPtr *Meta, agentUi cli.Ui) map[string]cli.CommandFactory {
Meta: meta,
}, nil
},
"job restart": func() (cli.Command, error) {
return &JobRestartCommand{
Meta: meta,
}, nil
},
"job deployments": func() (cli.Command, error) {
return &JobDeploymentsCommand{
Meta: meta,
Expand Down
Loading