Skip to content

Commit

Permalink
Fixing armadactl reprioritise (#168) (#3666)
Browse files Browse the repository at this point in the history
Co-authored-by: Mustafa Ilyas <Mustafa.Ilyas@gresearch.co.uk>
  • Loading branch information
MustafaI and mustafai-gr authored Jun 10, 2024
1 parent a8a64e4 commit e8d413e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cmd/armadactl/cmd/reprioritize.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@ func reprioritizeJobCmd() *cobra.Command {
},
RunE: func(cmd *cobra.Command, args []string) error {
// Ignoring first two arguments until Server API change makes queue and job-set a requirement

queue := args[0]
jobSet := args[1]
jobId := args[2]
priorityString := args[3]
priorityFactor, err := strconv.ParseFloat(priorityString, 64)
if err != nil {
return fmt.Errorf("error converting %s to float64: %s", priorityString, err)
}

return a.ReprioritizeJob(jobId, priorityFactor)
return a.ReprioritizeJob(queue, jobSet, jobId, priorityFactor)
},
}
return cmd
Expand Down
4 changes: 3 additions & 1 deletion internal/armadactl/reprioritize.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (a *App) ReprioritizeJobSet(queueName string, jobSet string, priorityFactor
}

// Reprioritize sets the priority of the job identified by (jobId) to priorityFactor
func (a *App) ReprioritizeJob(jobId string, priorityFactor float64) error {
func (a *App) ReprioritizeJob(queue string, jobSet string, jobId string, priorityFactor float64) error {
return client.WithSubmitClient(a.Params.ApiConnectionDetails, func(c api.SubmitClient) error {
var jobIds []string
if jobId != "" {
Expand All @@ -47,6 +47,8 @@ func (a *App) ReprioritizeJob(jobId string, priorityFactor float64) error {
defer cancel()

req := api.JobReprioritizeRequest{
Queue: queue,
JobSetId: jobSet,
JobIds: jobIds,
NewPriority: priorityFactor,
}
Expand Down

0 comments on commit e8d413e

Please sign in to comment.