Fix task group name
Previously when creating a job, Poseidon would still use the old task group name format instead of default-group as expected.
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package nomad
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
nomadApi "github.com/hashicorp/nomad/api"
|
||||
)
|
||||
|
||||
const (
|
||||
TaskGroupNameFormat = "%s-group"
|
||||
TaskName = "default-task"
|
||||
TaskGroupName = "default-group"
|
||||
TaskName = "default-task"
|
||||
)
|
||||
|
||||
// LoadJobList loads the list of jobs from the Nomad api.
|
||||
@@ -23,13 +22,13 @@ func (nc *nomadAPIClient) JobScale(jobID string) (jobScale uint, err error) {
|
||||
return
|
||||
}
|
||||
// ToDo: Consider counting also the placed and desired allocations
|
||||
jobScale = uint(status.TaskGroups[fmt.Sprintf(TaskGroupNameFormat, jobID)].Running)
|
||||
jobScale = uint(status.TaskGroups[TaskGroupName].Running)
|
||||
return
|
||||
}
|
||||
|
||||
// SetJobScale sets the scaling count of the passed job to Nomad.
|
||||
func (nc *nomadAPIClient) SetJobScale(jobID string, count uint, reason string) (err error) {
|
||||
intCount := int(count)
|
||||
_, _, err = nc.client.Jobs().Scale(jobID, fmt.Sprintf(TaskGroupNameFormat, jobID), &intCount, reason, false, nil, nil)
|
||||
_, _, err = nc.client.Jobs().Scale(jobID, TaskGroupName, &intCount, reason, false, nil, nil)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user