38 lines
1.1 KiB
Go
Executable file
38 lines
1.1 KiB
Go
Executable file
package jobs
|
|
|
|
import (
|
|
"xcecli/config"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// NewJobsCmd creates a jobs query command
|
|
func NewJobsCmd(configManager *config.ConfigManager) *cobra.Command {
|
|
|
|
// Create the parent jobs command
|
|
cmd := &cobra.Command{
|
|
Use: "jobs",
|
|
GroupID: "query",
|
|
Short: "Manage jobs",
|
|
Long: `Manage jobs in the system.
|
|
Use 'xce jobs list' to query jobs information.
|
|
Use 'xce jobs <action>' to submit/kill/stop/resume/checkpoint/restart jobs.`,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// Display help when no subcommand is specified
|
|
cmd.Help()
|
|
},
|
|
}
|
|
cmd.AddCommand(NewListJobsCmd(configManager))
|
|
// Add submit command to jobs command
|
|
cmd.AddCommand(NewSubmitJobsCmd(configManager))
|
|
// Add job control sub-commands to jobs command
|
|
cmd.AddCommand(NewKillJobsCmd(configManager))
|
|
cmd.AddCommand(NewStopJobsCmd(configManager))
|
|
cmd.AddCommand(NewResumeJobsCmd(configManager))
|
|
cmd.AddCommand(NewCheckPointJobsCmd(configManager))
|
|
cmd.AddCommand(NewRestartJobsCmd(configManager))
|
|
// Add peek command to view job output
|
|
cmd.AddCommand(NewPeekJobsCmd(configManager))
|
|
|
|
return cmd
|
|
}
|