Skip to content

Commit

Permalink
cli: allow batch job reschedule
Browse files Browse the repository at this point in the history
Batch jobs are able to be rescheduled without further steps, but
sysbatch jobs never receive a replacement allocation so they are still
not allowed to be rescheduled.
  • Loading branch information
lgfa29 committed Nov 28, 2023
1 parent 6f2ea97 commit 8e4719b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .changelog/19147.txt
@@ -1,3 +1,3 @@
```release-note:bug
cli: Fixed the `nomad job restart` command to create replacements for system jobs and prevent batch and sysbatch jobs from being rescheduled
cli: Fixed the `nomad job restart` command to create replacements for batch and system jobs and to prevent sysbatch jobs from being rescheduled since they never create replacements
```
5 changes: 3 additions & 2 deletions command/job_restart.go
Expand Up @@ -187,7 +187,8 @@ Restart Options:
in-place. Since the group is not modified the restart does not create a new
deployment, and so values defined in 'update' blocks, such as
'max_parallel', are not taken into account. This option cannot be used with
'-task'. Only jobs of type 'service' and 'system' can be rescheduled.
'-task'. Only jobs of type 'batch', 'service', and 'system' can be
rescheduled.
-task=<task-name>
Specify the task to restart. Can be specified multiple times. If groups are
Expand Down Expand Up @@ -289,7 +290,7 @@ func (c *JobRestartCommand) Run(args []string) int {
// Verify job type can be rescheduled.
if c.reschedule {
switch *job.Type {
case api.JobTypeService, api.JobTypeSystem:
case api.JobTypeBatch, api.JobTypeService, api.JobTypeSystem:
default:
c.Ui.Error(fmt.Sprintf("Jobs of type %q are not allowed to be rescheduled.", *job.Type))
return 1
Expand Down
3 changes: 2 additions & 1 deletion website/content/docs/commands/job/restart.mdx
Expand Up @@ -86,7 +86,8 @@ of the exact job ID.
restarted in-place. Since the group is not modified the restart does not
create a new deployment, and so values defined in [`update`][] blocks, such
as [`max_parallel`][], are not taken into account. This option cannot be used
with `-task`. Only jobs of type `service` and `system` can be rescheduled.
with `-task`. Only jobs of type `batch`, `service`, and `system` can be
rescheduled.

- `-on-error=<ask|fail>`: Determines what action to take when an error happens
during a restart batch. If `ask` the command stops and waits for user
Expand Down

0 comments on commit 8e4719b

Please sign in to comment.