Update the scaling policies when deregistering a job (#25911)

* func: Update the scaling policies when deregistering a job

* func: Add tests for updating the policy

* docs: add changelog

* func: set back the old order

* style: rearrange for clarity and to reuse the watchset

* func: set the policies to teh last submitted when starting a job

* func: expand tests  of teh start job command to include job submission

* func: Expand the tests to verify the correct state of the scaling policy after job start

* Update command/job_start.go

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* Update nomad/fsm_test.go

Co-authored-by: Tim Gross <tgross@hashicorp.com>

* func: add warning when there is no previous job submission

---------

Co-authored-by: Tim Gross <tgross@hashicorp.com>
This commit is contained in:
Juana De La Cuesta
2025-06-02 16:11:38 +02:00
committed by GitHub
parent ae3eaf80d1
commit bdfd573fc4
8 changed files with 195 additions and 20 deletions

View File

@@ -74,7 +74,11 @@ func testJob(jobID string) *api.Job {
AddTask(task).
RequireDisk(&api.EphemeralDisk{
SizeMB: pointer.Of(20),
})
}).ScalingPolicy(&api.ScalingPolicy{
Min: pointer.Of(int64(1)),
Max: pointer.Of(int64(5)),
Enabled: pointer.Of(true),
})
job := api.NewBatchJob(jobID, jobID, "global", 1).
AddDatacenter("dc1").