Skip to content

Commit

Permalink
Fix load cli command
Browse files Browse the repository at this point in the history
- remove job subcommands that were referring to the old job service
- update `load` subcommand and add necessary flags
- remove checks in the java class that referred to the old load command
			pr-link: #18045
			change-id: cid-31fce5258be608e7d34648e07940857d30340c60
  • Loading branch information
Xenorith authored Aug 22, 2023
1 parent 25a2c4a commit 7505ea4
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 329 deletions.
61 changes: 0 additions & 61 deletions cli/src/alluxio.org/cli/cmd/job/cancel.go

This file was deleted.

61 changes: 0 additions & 61 deletions cli/src/alluxio.org/cli/cmd/job/cmd_status.go

This file was deleted.

61 changes: 55 additions & 6 deletions cli/src/alluxio.org/cli/cmd/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,66 @@

package job

import "alluxio.org/cli/env"
import (
"github.com/palantir/stacktrace"
"github.com/spf13/cobra"

"alluxio.org/cli/env"
)

var Service = &env.Service{
Name: "job",
Description: "Command line tool for interacting with the job service.",
Commands: []env.Command{
Cancel,
CmdStatus,
JobStatus,
Leader,
List,
Load,
},
}

const (
progress = "progress"
stop = "stop"
submit = "submit"
)

var operations = []string{
progress,
stop,
submit,
}

type BaseJobCommand struct {
*env.BaseJavaCommand

isProgress bool
isStop bool
isSubmit bool

progressFormat string
progressVerbose bool
}

func (c *BaseJobCommand) AttachOperationFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&c.isProgress, progress, false, "View progress of submitted job")
cmd.Flags().BoolVar(&c.isStop, stop, false, "Stop running job")
cmd.Flags().BoolVar(&c.isSubmit, submit, false, "Submit job")
cmd.MarkFlagsMutuallyExclusive(operations...)

cmd.Flags().StringVar(&c.progressFormat, "format", "TEXT", "[progress] Format of output, either TEXT or JSON")
cmd.Flags().BoolVar(&c.progressVerbose, "verbose", false, "[progress] Verbose output")
}

func (c *BaseJobCommand) OperationWithArgs() ([]string, error) {
// rely on MarkFlagsMutuallyExclusive to ensure there is at most one boolean switched to true
if c.isProgress {
ret := []string{"--" + progress, "--format", c.progressFormat}
if c.progressVerbose {
ret = append(ret, "--verbose")
}
return ret, nil
} else if c.isStop {
return []string{"--" + stop}, nil
} else if c.isSubmit {
return []string{"--" + submit}, nil
}
return nil, stacktrace.NewError("Did not specify an operation flag: %v", operations)
}
67 changes: 0 additions & 67 deletions cli/src/alluxio.org/cli/cmd/job/job_status.go

This file was deleted.

51 changes: 0 additions & 51 deletions cli/src/alluxio.org/cli/cmd/job/leader.go

This file was deleted.

52 changes: 0 additions & 52 deletions cli/src/alluxio.org/cli/cmd/job/list.go

This file was deleted.

Loading

0 comments on commit 7505ea4

Please sign in to comment.