@@ -21,7 +21,7 @@ const (
2121)
2222
2323var (
24- app = kingpin .New ("harbormaster" , "a thingy that makes working with the boats easier " )
24+ app = kingpin .New ("harbormaster" , "Azkaban power tools " )
2525
2626 dumpResponses = app .Flag ("dump-responses" , "Dump all HTTP responses from Azkaban to stdout" ).Bool ()
2727
@@ -30,23 +30,20 @@ var (
3030 loginUsername = login .Arg ("username" , "username" ).Required ().String ()
3131 loginPassword = login .Arg ("password" , "password" ).Required ().String ()
3232
33- projects = app .Command ("project" , "" )
34- projectsList = projects .Command ("list" , "" )
35-
36- flows = app .Command ("flow" , "" )
37- flowsList = flows .Command ("list" , "" )
38- flowsProject = flowsList .Arg ("project" , "" ).Required ().HintAction (suggestProjects ).String ()
39- flowsFilter = flowsList .Arg ("filter" , "" ).String ()
40-
41- executions = app .Command ("executions" , "" )
42- executionsProject = executions .Arg ("project" , "" ).Required ().HintAction (suggestProjects ).String ()
43- executionsFlow = executions .Arg ("flow" , "" ).Required ().String ()
44-
4533 logs = app .Command ("logs" , "Fetchs logs for an execution, either via URL or by job and exec ID" )
4634 logURL = logs .Arg ("url" , "execution URL" ).URL ()
4735 logsJobID = logs .Arg ("jobID" , "job ID" ).HintAction (suggestProjects ).String ()
4836 logsExecID = logs .Arg ("execID" , "exec ID" ).HintAction (suggestExecID ).Int64 ()
4937 logsFollow = logs .Flag ("follow" , "follow log, indefinitely updates every 2 seconds" ).Short ('f' ).Default ("false" ).Bool ()
38+
39+ get = app .Command ("get" , "get things from azkaban" ).Alias ("g" )
40+ getProjects = get .Command ("projects" , "get all projects" ).Alias ("p" )
41+ getFlows = get .Command ("flows" , "get flows" ).Alias ("f" )
42+ getFlowsFilter = getFlows .Arg ("filter" , "show only flows with this prefix" ).String ()
43+ getFlowsProject = getFlows .Flag ("project" , "project, can be set by HARBORMASTER_PROJECT" ).Envar ("HARBORMASTER_PROJECT" ).String ()
44+ getExecutions = get .Command ("executions" , "get executions" ).Alias ("e" )
45+ getExecutionsFlow = getExecutions .Arg ("flow" , "name of flow to fetch executions for" ).String ()
46+ getExecutionsProject = getExecutions .Flag ("project" , "project, can be set by HARBORMASTER_PROJECT" ).Envar ("HARBORMASTER_PROJECT" ).String ()
5047)
5148
5249func suggestExecID () []string {
@@ -69,7 +66,8 @@ func main() {
6966
7067 fmt .Printf ("export %s=%s\n " , AzkabanSessionIDEnv , client .SessionID )
7168 fmt .Printf ("export %s=%s\n " , AzkabanHostEnv , (* loginHost ).String ())
72- case projectsList .FullCommand ():
69+
70+ case getProjects .FullCommand ():
7371 projectRepo := context .Projects ()
7472 projects , err := projectRepo .ListProjects ()
7573 if err != nil {
@@ -91,28 +89,28 @@ func main() {
9189 }
9290 w .Flush ()
9391
94- case flowsList .FullCommand ():
92+ case getFlows .FullCommand ():
9593 client := getClient ()
9694
97- flows , err := client .ListFlows (* flowsProject )
95+ flows , err := client .ListFlows (* getFlowsProject )
9896 if err != nil {
9997 panic (err )
10098 }
10199
102100 for _ , f := range flows {
103- if len (* flowsFilter ) > 0 {
104- if strings .HasPrefix (f .FlowID , * flowsFilter ) {
101+ if len (* getFlowsFilter ) > 0 {
102+ if strings .HasPrefix (f .FlowID , * getFlowsFilter ) {
105103 fmt .Printf ("%s\n " , f .FlowID )
106104 }
107105 } else {
108106 fmt .Printf ("%s\n " , f .FlowID )
109107 }
110108 }
111109
112- case executions .FullCommand ():
110+ case getExecutions .FullCommand ():
113111 client := getClient ()
114112
115- executions , err := client .FlowExecutions (* executionsProject , * executionsFlow )
113+ executions , err := client .FlowExecutions (* getExecutionsProject , * getExecutionsFlow )
116114 if err != nil {
117115 panic (err )
118116 }
0 commit comments