-
Notifications
You must be signed in to change notification settings - Fork 137
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
Preempt/Cancel on executor #4022
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
71069dc
Preempt/Cancel on executor proto changes
mustafai-gr c312308
typo
mustafai-gr b36f447
Cancelling and preempting by executor
mustafai-gr 1575237
Merge master into branch
mustafai-gr c1d7868
Adding tests
mustafai-gr befa0ef
Removing unused proto
mustafai-gr 7cda769
Merge branch 'master' of github.com:armadaproject/armada into mustafa…
mustafai-gr 0950cb2
Changing armadactl cancel/preempt on executor flags, adding correctly…
mustafai-gr 86f5010
Update preempt.go
MustafaI df93f48
Update cancel.go
MustafaI d640f19
Update cancel.go
MustafaI 8c85f4c
Update preempt.go
MustafaI 46f5886
Update cancel.go
MustafaI 8a8c4eb
Update preempt.go
MustafaI 8c17bfd
Update cancel.go
MustafaI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/armadaproject/armada/internal/armadactl" | ||
|
@@ -12,7 +14,10 @@ func preemptCmd() *cobra.Command { | |
Short: "Preempt jobs in armada.", | ||
Args: cobra.ExactArgs(0), | ||
} | ||
cmd.AddCommand(preemptJobCmd()) | ||
cmd.AddCommand( | ||
preemptJobCmd(), | ||
preemptExecutorCmd(), | ||
) | ||
return cmd | ||
} | ||
|
||
|
@@ -35,3 +40,42 @@ func preemptJobCmd() *cobra.Command { | |
} | ||
return cmd | ||
} | ||
|
||
func preemptExecutorCmd() *cobra.Command { | ||
a := armadactl.New() | ||
cmd := &cobra.Command{ | ||
Use: "executor <executor>", | ||
Short: "Preempts jobs on executor.", | ||
Long: `Preempts jobs on executor with provided executor name, priority classes and queues.`, | ||
Args: cobra.ExactArgs(1), | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
if err := cmd.MarkFlagRequired("priority-classes"); err != nil { | ||
return fmt.Errorf("error marking priority-class flag as required: %s", err) | ||
} | ||
return initParams(cmd, a.Params) | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
onExecutor := args[0] | ||
|
||
priorityClasses, err := cmd.Flags().GetStringSlice("priority-classes") | ||
if err != nil { | ||
return fmt.Errorf("error reading priority-class selection: %s", err) | ||
} | ||
|
||
queues, err := cmd.Flags().GetStringSlice("queues") | ||
if err != nil { | ||
return fmt.Errorf("error reading queue selection: %s", err) | ||
} | ||
|
||
return a.PreemptOnExecutor(onExecutor, queues, priorityClasses) | ||
}, | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to last comment |
||
cmd.Flags().StringSliceP( | ||
"queues", | ||
"q", | ||
[]string{}, | ||
"Preempt jobs on executor matching the specified queue names. If no queues are provided, jobs across all queues will be preempted. Provided queues should be comma separated, as in the following example: queueA,queueB,queueC.", | ||
) | ||
cmd.Flags().StringSliceP("priority-classes", "p", []string{}, "Preempt jobs on executor matching the specified priority classes. Provided priority classes should be comma separated, as in the following example: armada-default,armada-preemptible.") | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest
--match-queues
to just--queues
--queues
requires a command line argument, then priority classes should require a--priority-classes
arg.