Skip to content

Commit

Permalink
bugfix: fix asynchronous experiment creation
Browse files Browse the repository at this point in the history
Signed-off-by: xcaspar <changjun.xcj@alibaba-inc.com>
  • Loading branch information
xcaspar committed Aug 16, 2021
1 parent efbda4e commit 74ddcbb
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cli/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,15 @@ func (cc *CreateCommand) bindFlagsFunction() func(commandFlags map[string]func()
func (cc *CreateCommand) actionRunEFunc(target, scope string, actionCommand *actionCommand, actionCommandSpec spec.ExpActionCommandSpec) func(cmd *cobra.Command, args []string) error {
return func(cmd *cobra.Command, args []string) error {
expModel := createExpModel(target, scope, actionCommandSpec.Name(), cmd)

// check timeout flag
tt := expModel.ActionFlags["timeout"]

if tt != "" {

//errNumber checks whether timout flag is parsable as Number
if _, errNumber := strconv.ParseUint(tt, 10, 64); errNumber != nil {

//err checks whether timout flag is parsable as Time
if _, err := time.ParseDuration(tt); err != nil {
return err
}

}
}
nohup := expModel.ActionFlags[NohupFlag] == "true"
Expand Down Expand Up @@ -149,8 +144,10 @@ func (cc *CreateCommand) actionRunEFunc(target, scope string, actionCommand *act
var args string
if scope == "host" {
args = fmt.Sprintf("create %s %s --uid %s --nohup=true", target, actionCommand.Name(), model.Uid)
} else {
} else if scope == "docker" {
args = fmt.Sprintf("create %s %s %s --uid %s --nohup=true", scope, target, actionCommand.Name(), model.Uid)
} else {
args = fmt.Sprintf("create k8s %s-%s %s --uid %s --nohup=true", scope, target, actionCommand.Name(), model.Uid)
}
cmd.Flags().VisitAll(func(flag *pflag.Flag) {
if flag.Value.String() == "false" {
Expand Down

0 comments on commit 74ddcbb

Please sign in to comment.