Skip to content
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

modify the return value of 'vcctl' #460

Merged
merged 1 commit into from
Sep 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/cli/vkctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package main

import (
"fmt"
"os"
"time"

"github.com/golang/glog"
Expand Down Expand Up @@ -47,6 +48,7 @@ func main() {

if err := rootCmd.Execute(); err != nil {
fmt.Printf("Failed to execute command: %v\n", err)
os.Exit(2)
}
}

Expand All @@ -60,6 +62,7 @@ func checkError(cmd *cobra.Command, err error) {
}

fmt.Printf("%s: %v\n", msg, err)
os.Exit(2)
}
}

Expand Down
13 changes: 2 additions & 11 deletions pkg/cli/job/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,14 @@ func RunJob() error {
return err
}

req, err := populateResourceListV1(launchJobFlags.Requests)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function runs twice to get arg 'req' and 'limit', and the two args are used only when the default job 'test' is started.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got that.

if err != nil {
return err
}

limit, err := populateResourceListV1(launchJobFlags.Limits)
if err != nil {
return err
}

job, err := readFile(launchJobFlags.FileName)
if err != nil {
return err
}

if job == nil {
job = constructLaunchJobFlagsJob(launchJobFlags, req, limit)
fmt.Printf("Error: job script (specified by --filename or -f) is mandatory to run a particular job")
return nil
}

jobClient := versioned.NewForConfigOrDie(config)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/job/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ViewJob() error {
return err
}
if viewJobFlags.JobName == "" {
err := fmt.Errorf("job name (specified by --name or -N) is mandaorty to view a particular job")
err := fmt.Errorf("job name (specified by --name or -N) is mandatory to view a particular job")
return err
}

Expand Down