diff --git a/pkg/cli/job/common.go b/pkg/cli/job/common.go index ed1ba0e32f..43fff20759 100644 --- a/pkg/cli/job/common.go +++ b/pkg/cli/job/common.go @@ -28,7 +28,7 @@ type commonFlags struct { } func initFlags(cmd *cobra.Command, cf *commonFlags) { - cmd.Flags().StringVarP(&cf.SchedulerName, "scheduler", "S", "vn-scheduler", "the scheduler for this job") + cmd.Flags().StringVarP(&cf.SchedulerName, "scheduler", "S", "kube-batch", "the scheduler for this job") cmd.Flags().StringVarP(&cf.Master, "master", "s", "", "the address of apiserver") if home := homeDir(); home != "" { diff --git a/pkg/cli/job/delete.go b/pkg/cli/job/delete.go index f60acd9760..e6f697b500 100644 --- a/pkg/cli/job/delete.go +++ b/pkg/cli/job/delete.go @@ -47,6 +47,11 @@ func DeleteJob() error { return err } + if deleteJobFlags.JobName == "" { + err := fmt.Errorf("job name is mandaorty to delete a particular job") + return err + } + jobClient := versioned.NewForConfigOrDie(config) err = jobClient.BatchV1alpha1().Jobs(deleteJobFlags.Namespace).Delete(deleteJobFlags.JobName, &metav1.DeleteOptions{}) if err != nil { diff --git a/pkg/cli/job/resume.go b/pkg/cli/job/resume.go index 54733bd223..d73c1d6dcd 100644 --- a/pkg/cli/job/resume.go +++ b/pkg/cli/job/resume.go @@ -16,6 +16,7 @@ limitations under the License. package job import ( + "fmt" "github.com/spf13/cobra" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" @@ -42,6 +43,10 @@ func ResumeJob() error { if err != nil { return err } + if resumeJobFlags.JobName == "" { + err := fmt.Errorf("job name is mandaorty to resume a particular job") + return err + } return createJobCommand(config, resumeJobFlags.Namespace, resumeJobFlags.JobName, diff --git a/pkg/cli/job/suspend.go b/pkg/cli/job/suspend.go index 85f0d807b0..504cdd2381 100644 --- a/pkg/cli/job/suspend.go +++ b/pkg/cli/job/suspend.go @@ -16,6 +16,7 @@ limitations under the License. package job import ( + "fmt" "github.com/spf13/cobra" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" @@ -43,6 +44,11 @@ func SuspendJob() error { return err } + if suspendJobFlags.JobName == "" { + err := fmt.Errorf("job name is mandaorty to suspend a particular job") + return err + } + return createJobCommand(config, suspendJobFlags.Namespace, suspendJobFlags.JobName, v1alpha1.AbortJobAction) diff --git a/pkg/cli/queue/get.go b/pkg/cli/queue/get.go index af73b6cf7a..bc5a256bcf 100644 --- a/pkg/cli/queue/get.go +++ b/pkg/cli/queue/get.go @@ -52,7 +52,7 @@ func GetQueue() error { } if getQueueFlags.Name == "" { - err := fmt.Errorf("name is mandaorty to get the partiular queue details") + err := fmt.Errorf("name is mandaorty to get the particular queue details") return err }