-
Notifications
You must be signed in to change notification settings - Fork 127
/
scheduling.go
69 lines (63 loc) · 1.79 KB
/
scheduling.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package cmd
import (
"strings"
"github.com/spf13/cobra"
"github.com/armadaproject/armada/internal/armadactl"
)
func getSchedulingReportCmd(a *armadactl.App) *cobra.Command {
cmd := &cobra.Command{
Use: "scheduling-report",
Short: "Get scheduler reports",
Args: cobra.ExactArgs(0),
SilenceUsage: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return initParams(cmd, a.Params)
},
RunE: func(cmd *cobra.Command, args []string) error {
return a.GetSchedulingReport()
},
}
return cmd
}
func getQueueSchedulingReportCmd(a *armadactl.App) *cobra.Command {
cmd := &cobra.Command{
Use: "queue-report",
Short: "Get queue scheduler reports",
Args: cobra.ExactArgs(0),
SilenceUsage: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return initParams(cmd, a.Params)
},
RunE: func(cmd *cobra.Command, args []string) error {
queue, err := cmd.Flags().GetString("queue")
if err != nil {
return err
}
queue = strings.TrimSpace(queue)
return a.GetQueueSchedulingReport(queue)
},
}
cmd.Flags().String("queue", "", "Queue name to query reports for.")
return cmd
}
func getJobSchedulingReportCmd(a *armadactl.App) *cobra.Command {
cmd := &cobra.Command{
Use: "job-report",
Short: "Get job scheduler reports",
Args: cobra.ExactArgs(0),
SilenceUsage: true,
PreRunE: func(cmd *cobra.Command, args []string) error {
return initParams(cmd, a.Params)
},
RunE: func(cmd *cobra.Command, args []string) error {
jobId, err := cmd.Flags().GetString("jobId")
if err != nil {
return err
}
jobId = strings.TrimSpace(jobId)
return a.GetJobSchedulingReport(jobId)
},
}
cmd.Flags().String("jobId", "", "Id of job to query reports for.")
return cmd
}