Skip to content

Commit

Permalink
Update after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mszadkow committed Oct 11, 2024
1 parent 2d40187 commit eea63b1
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ type TemplateReference string
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || !('ntasks' in self.requiredFlags) || self.name == 'Slurm'", message="ntasks flag can be used only on Slurm mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || !('output' in self.requiredFlags) || self.name == 'Slurm'", message="output flag can be used only on Slurm mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || !('partition' in self.requiredFlags) || self.name == 'Slurm'", message="partition flag can be used only on Slurm mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || !('priority' in self.requiredFlags) || self.name != 'Interactive'", message="priority flag can't be used only on Interactive mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || !('skip-priority-validation' in self.requiredFlags) || self.name != 'Interactive'", message="skip priority validation flag can't be used only on Interactive mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || !('priority' in self.requiredFlags) || self.name != 'Interactive'", message="priority flag can't be used on Interactive mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || self.name != 'Slurm' || !('parallelism' in self.requiredFlags)", message="parallelism flag can't be used on Slurm mode"
// +kubebuilder:validation:XValidation:rule="!has(self.requiredFlags) || self.name != 'Slurm' || !('completions' in self.requiredFlags)", message="completions flag can't be used on Slurm mode"
type SupportedMode struct {
Expand Down Expand Up @@ -131,7 +130,7 @@ type SupportedMode struct {
//
// +optional
// +listType=set
// +kubebuilder:validation:MaxItems=14
// +kubebuilder:validation:MaxItems=13
RequiredFlags []Flag `json:"requiredFlags,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec:
- output
- partition
type: string
maxItems: 14
maxItems: 13
type: array
x-kubernetes-list-type: set
template:
Expand Down Expand Up @@ -184,13 +184,9 @@ spec:
- message: partition flag can be used only on Slurm mode
rule: '!has(self.requiredFlags) || !(''partition'' in self.requiredFlags)
|| self.name == ''Slurm'''
- message: priority flag can't be used only on Interactive mode
- message: priority flag can't be used on Interactive mode
rule: '!has(self.requiredFlags) || !(''priority'' in self.requiredFlags)
|| self.name != ''Interactive'''
- message: skip priority validation flag can't be used only on Interactive
mode
rule: '!has(self.requiredFlags) || !(''skip-priority-validation''
in self.requiredFlags) || self.name != ''Interactive'''
- message: parallelism flag can't be used on Slurm mode
rule: '!has(self.requiredFlags) || self.name != ''Slurm'' || !(''parallelism''
in self.requiredFlags)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The file is auto-generated from the Go source code of the component using the
Create a job

```
kjobctl create job --profile APPLICATION_PROFILE_NAME [--localqueue LOCAL_QUEUE_NAME] [--skip-localqueue-validation] [--skip-priority-validation] [--cmd COMMAND] [--request RESOURCE_NAME=QUANTITY] [--parallelism PARALLELISM] [--completions COMPLETIONS] [--priority NAME]
kjobctl create job --profile APPLICATION_PROFILE_NAME [--localqueue LOCAL_QUEUE_NAME] [--skip-localqueue-validation] [--cmd COMMAND] [--request RESOURCE_NAME=QUANTITY] [--parallelism PARALLELISM] [--completions COMPLETIONS] [--priority NAME] [--skip-priority-validation]
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Create a raycluster.
KubeRay operator is required for RayCluster. How to install KubeRay operator you can find here https://ray-project.github.io/kuberay/deploy/installation/.

```
kjobctl create raycluster --profile APPLICATION_PROFILE_NAME [--localqueue LOCAL_QUEUE_NAME] [--skip-localqueue-validation] [--skip-priority-validation] [--replicas [WORKER_GROUP]=REPLICAS] [--min-replicas [WORKER_GROUP]=MIN_REPLICAS] [--max-replicas [WORKER_GROUP]=MAX_REPLICAS] [--priority NAME]
kjobctl create raycluster --profile APPLICATION_PROFILE_NAME [--localqueue LOCAL_QUEUE_NAME] [--skip-localqueue-validation] [--replicas [WORKER_GROUP]=REPLICAS] [--min-replicas [WORKER_GROUP]=MIN_REPLICAS] [--max-replicas [WORKER_GROUP]=MAX_REPLICAS] [--priority NAME] [--skip-priority-validation]
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Create a rayjob.
KubeRay operator is required for RayJob. How to install KubeRay operator you can find here https://ray-project.github.io/kuberay/deploy/installation/.

```
kjobctl create rayjob --profile APPLICATION_PROFILE_NAME [--localqueue LOCAL_QUEUE_NAME] [--skip-localqueue-validation] [--skip-priority-validation] [--cmd COMMAND] [--replicas [WORKER_GROUP]=REPLICAS] [--min-replicas [WORKER_GROUP]=MIN_REPLICAS] [--max-replicas [WORKER_GROUP]=MAX_REPLICAS] [--priority NAME]
kjobctl create rayjob --profile APPLICATION_PROFILE_NAME [--localqueue LOCAL_QUEUE_NAME] [--skip-localqueue-validation] [--cmd COMMAND] [--replicas [WORKER_GROUP]=REPLICAS] [--min-replicas [WORKER_GROUP]=MIN_REPLICAS] [--max-replicas [WORKER_GROUP]=MAX_REPLICAS] [--priority NAME] [--skip-priority-validation]
```


Expand Down
13 changes: 5 additions & 8 deletions cmd/experimental/kjobctl/pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,11 @@ func (b *Builder) validateGeneral(ctx context.Context) error {
}
}

// priority class is checked excluding interactive mode
if b.modeName != v1alpha1.InteractiveMode {
// check that priority class exists
if len(b.priority) != 0 && !b.skipPriorityValidation {
_, err := b.kueueClientset.KueueV1beta1().WorkloadPriorityClasses().Get(ctx, b.priority, metav1.GetOptions{})
if err != nil {
return err
}
// check that priority class exists
if len(b.priority) != 0 && !b.skipPriorityValidation {
_, err := b.kueueClientset.KueueV1beta1().WorkloadPriorityClasses().Get(ctx, b.priority, metav1.GetOptions{})
if err != nil {
return err
}
}

Expand Down
18 changes: 9 additions & 9 deletions cmd/experimental/kjobctl/pkg/cmd/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,12 @@ var createModeSubcommands = map[string]modeSubcommand{
"job": {
ModeName: v1alpha1.JobMode,
Setup: func(clientGetter util.ClientGetter, subcmd *cobra.Command, o *CreateOptions) {
subcmd.Use += " [--skip-priority-validation]" +
" [--cmd COMMAND]" +
subcmd.Use += " [--cmd COMMAND]" +
" [--request RESOURCE_NAME=QUANTITY]" +
" [--parallelism PARALLELISM]" +
" [--completions COMPLETIONS]" +
" [--priority NAME]"
" [--priority NAME]" +
" [--skip-priority-validation]"
subcmd.Short = "Create a job"
subcmd.Example = createJobExample

Expand Down Expand Up @@ -285,12 +285,12 @@ var createModeSubcommands = map[string]modeSubcommand{
"rayjob": {
ModeName: v1alpha1.RayJobMode,
Setup: func(clientGetter util.ClientGetter, subcmd *cobra.Command, o *CreateOptions) {
subcmd.Use += " [--skip-priority-validation]" +
" [--cmd COMMAND]" +
subcmd.Use += " [--cmd COMMAND]" +
" [--replicas [WORKER_GROUP]=REPLICAS]" +
" [--min-replicas [WORKER_GROUP]=MIN_REPLICAS]" +
" [--max-replicas [WORKER_GROUP]=MAX_REPLICAS]" +
" [--priority NAME]"
" [--priority NAME]" +
" [--skip-priority-validation]"
subcmd.Short = "Create a rayjob"
subcmd.Long = createRayJobLong
subcmd.Example = createRayJobExample
Expand Down Expand Up @@ -319,11 +319,11 @@ var createModeSubcommands = map[string]modeSubcommand{
"raycluster": {
ModeName: v1alpha1.RayClusterMode,
Setup: func(clientGetter util.ClientGetter, subcmd *cobra.Command, o *CreateOptions) {
subcmd.Use += " [--skip-priority-validation]" +
" [--replicas [WORKER_GROUP]=REPLICAS]" +
subcmd.Use += " [--replicas [WORKER_GROUP]=REPLICAS]" +
" [--min-replicas [WORKER_GROUP]=MIN_REPLICAS]" +
" [--max-replicas [WORKER_GROUP]=MAX_REPLICAS]" +
" [--priority NAME]"
" [--priority NAME]" +
" [--skip-priority-validation]"
subcmd.Short = "Create a raycluster"
subcmd.Long = createRayClusterLong
subcmd.Example = createRayClusterExample
Expand Down
Binary file modified cmd/experimental/kjobctl/pkg/cmd/printcrds/embed/manifest.gz
Binary file not shown.

0 comments on commit eea63b1

Please sign in to comment.