13
13
* License for the specific language governing permissions and limitations under
14
14
* the License.
15
15
*/
16
- package com.linkedin.gradle.azkaban.client ;
16
+ package com.linkedin.gradle.azkaban.client
17
17
18
- import com.linkedin.gradle.util.HttpUtil ;
19
- import org.apache.http.client.utils.URIBuilder ;
18
+ import com.linkedin.gradle.util.HttpUtil
19
+ import org.apache.http.client.utils.URIBuilder
20
20
21
21
/**
22
22
* Azkaban Client for Azkaban.
@@ -25,247 +25,247 @@ class AzkabanClient {
25
25
/**
26
26
* Creates a project in Azkaban.
27
27
*
28
- * @param URL AzkabanCluster URL
28
+ * @param url AzkabanCluster URL
29
29
* @param projectName Azkaban Project Name
30
30
* @param description Project Description
31
31
* @param sessionId The Azkaban session id
32
32
* @return
33
33
*/
34
- static String createProject (String URL , String projectName , String description , String sessionId ) throws Exception {
35
- return HttpUtil . responseFromPOST(new URIBuilder (URL )
34
+ static String createProject (String url , String projectName , String description , String sessionId ) throws Exception {
35
+ return HttpUtil . responseFromPOST(new URIBuilder (url )
36
36
.setPath(AzkabanParams . MANAGER )
37
37
.setParameter(AzkabanParams . SESSIONID , sessionId)
38
38
.setParameter(AzkabanParams . ACTION , " create" )
39
39
.setParameter(AzkabanParams . NAME , projectName)
40
40
.setParameter(AzkabanParams . DESCRIPTION , description)
41
- .build());
41
+ .build())
42
42
}
43
43
44
44
/**
45
45
* Executes a flow in Azkaban.
46
46
*
47
- * @param URL AzkabanCluster URL
47
+ * @param url AzkabanCluster URL
48
48
* @param projectName Azkaban Project Name
49
49
* @param flow Flow Name
50
50
* @param sessionId The Azkaban session id
51
51
* @return
52
52
*/
53
- static String executeFlow (String URL , String projectName , String flow , String sessionId ) throws Exception {
54
- return HttpUtil . responseFromGET(new URIBuilder (URL )
53
+ static String executeFlow (String url , String projectName , String flow , String sessionId ) throws Exception {
54
+ return HttpUtil . responseFromGET(new URIBuilder (url )
55
55
.setPath(AzkabanParams . EXECUTOR )
56
56
.addParameter(AzkabanParams . SESSIONID , sessionId)
57
57
.addParameter(AzkabanParams . AJAX , " executeFlow" )
58
58
.addParameter(AzkabanParams . PROJECT , projectName)
59
59
.addParameter(AzkabanParams . FLOW , flow)
60
- .build());
60
+ .build())
61
61
}
62
62
63
63
/**
64
64
* Fetches flow Executions from Azkaban.
65
65
*
66
- * @param URL AzkabanCluster URL
66
+ * @param url AzkabanCluster URL
67
67
* @param projectName Azkaban Project Name
68
68
* @param flow Flow Name
69
69
* @param startIndex Index of execution to start from
70
70
* @param endIndex Index of execution to end
71
71
* @param sessionId The Azkaban session id
72
72
* @return
73
73
*/
74
- static String fetchExecutionsList (String URL , String projectName , String flow , String startIndex , String endIndex , String sessionId ) throws Exception {
75
- return HttpUtil . responseFromGET(new URIBuilder (URL )
74
+ static String fetchExecutionsList (String url , String projectName , String flow , String startIndex , String endIndex , String sessionId ) throws Exception {
75
+ return HttpUtil . responseFromGET(new URIBuilder (url )
76
76
.setPath(AzkabanParams . MANAGER )
77
77
.addParameter(AzkabanParams . SESSIONID , sessionId)
78
78
.addParameter(AzkabanParams . AJAX , " fetchFlowExecutions" )
79
79
.addParameter(AzkabanParams . PROJECT , projectName)
80
80
.addParameter(AzkabanParams . FLOW , flow)
81
81
.addParameter(AzkabanParams . START , startIndex)
82
82
.addParameter(AzkabanParams . LENGTH , endIndex)
83
- .build());
83
+ .build())
84
84
}
85
85
86
86
/**
87
87
* Fetches all the detailed information of that execution, including a list of all the job executions
88
88
* from Azkaban.
89
89
*
90
- * @param URL AzkabanCluster URL
90
+ * @param url AzkabanCluster URL
91
91
* @param execId Azkaban flow execution id
92
92
* @param sessionId The Azkaban session id
93
93
* @return
94
94
*/
95
- static String fetchFlowExecution (String URL , String execId , String sessionId ) throws Exception {
96
- return HttpUtil . responseFromGET(new URIBuilder (URL )
95
+ static String fetchFlowExecution (String url , String execId , String sessionId ) throws Exception {
96
+ return HttpUtil . responseFromGET(new URIBuilder (url )
97
97
.setPath(AzkabanParams . EXECUTOR )
98
98
.setParameter(AzkabanParams . SESSIONID , sessionId)
99
99
.setParameter(AzkabanParams . AJAX , " fetchexecflow" )
100
100
.setParameter(AzkabanParams . EXECID , execId)
101
- .build());
101
+ .build())
102
102
}
103
103
104
104
/**
105
105
* Fetch flows of the project in Azkaban.
106
106
*
107
- * @param URL AzkabanCluster URL
107
+ * @param url AzkabanCluster URL
108
108
* @param projectName Azkaban Project Name
109
109
* @param sessionId The Azkaban session id
110
110
* @return
111
111
*/
112
- static String fetchProjectFlows (String URL , String projectName , String sessionId ) throws Exception {
113
- return HttpUtil . responseFromGET(new URIBuilder (URL )
112
+ static String fetchProjectFlows (String url , String projectName , String sessionId ) throws Exception {
113
+ return HttpUtil . responseFromGET(new URIBuilder (url )
114
114
.setPath(AzkabanParams . MANAGER )
115
115
.addParameter(AzkabanParams . SESSIONID , sessionId)
116
116
.addParameter(AzkabanParams . AJAX , " fetchprojectflows" )
117
117
.addParameter(AzkabanParams . PROJECT , projectName)
118
- .build());
118
+ .build())
119
119
}
120
120
121
121
/**
122
122
* Executes Multiple flows in Azkaban.
123
123
*
124
- * @param URL AzkabanCluster URL
124
+ * @param url AzkabanCluster URL
125
125
* @param projectName Azkaban Project Name
126
126
* @param flows List of all flows in the Project
127
127
* @param sessionId The Azkaban session id
128
128
* @return
129
129
*/
130
- static List<String > batchFlowExecution (String URL , String projectName , List<String > flows , String sessionId ) throws Exception {
130
+ static List<String > batchFlowExecution (String url , String projectName , List<String > flows , String sessionId ) throws Exception {
131
131
// Pool HTTP Get requests for executing flows
132
- List<URI > executeUriList = new ArrayList< URI > ();
132
+ List<URI > executeUriList = []
133
133
flows. each { flow ->
134
- executeUriList. add(new URIBuilder (URL )
134
+ executeUriList. add(new URIBuilder (url )
135
135
.setPath(AzkabanParams . EXECUTOR )
136
136
.addParameter(AzkabanParams . SESSIONID , sessionId)
137
137
.addParameter(AzkabanParams . AJAX , " executeFlow" )
138
138
.addParameter(AzkabanParams . PROJECT , projectName)
139
139
.addParameter(AzkabanParams . FLOW , flow)
140
- .build());
140
+ .build())
141
141
}
142
- return HttpUtil . batchGet(executeUriList);
142
+ return HttpUtil . batchGet(executeUriList)
143
143
}
144
144
145
145
/**
146
146
* Fetches Latest Flow Execution for Multiple flows in Azkaban.
147
147
*
148
- * @param URL AzkabanCluster URL
148
+ * @param url AzkabanCluster URL
149
149
* @param projectName Azkaban Project Name
150
150
* @param flows List of Flow names for which latest execution is needed
151
151
* @param sessionId The Azkaban session id
152
152
* @return List of response containing Latest execution for each flow.
153
153
*/
154
- static List<String > batchFetchLatestExecution (String URL , String projectName , List<String > flows , String sessionId ) throws Exception {
154
+ static List<String > batchFetchLatestExecution (String url , String projectName , List<String > flows , String sessionId ) throws Exception {
155
155
// Pool HTTP Get requests for getting most recent ExecID for each flow
156
- List<URI > uriList = new ArrayList< URI > ();
156
+ List<URI > uriList = []
157
157
for (String flow : flows) {
158
- uriList. add(new URIBuilder (URL )
158
+ uriList. add(new URIBuilder (url )
159
159
.setPath(AzkabanParams . MANAGER )
160
160
.addParameter(AzkabanParams . SESSIONID , sessionId)
161
161
.addParameter(AzkabanParams . AJAX , " fetchFlowExecutions" )
162
162
.addParameter(AzkabanParams . PROJECT , projectName)
163
163
.addParameter(AzkabanParams . FLOW , flow)
164
164
.addParameter(AzkabanParams . START , " 0" )
165
165
.addParameter(AzkabanParams . LENGTH , " 1" )
166
- .build());
166
+ .build())
167
167
}
168
- return HttpUtil . batchGet(uriList);
168
+ return HttpUtil . batchGet(uriList)
169
169
}
170
170
171
171
/**
172
172
* Fetches a batch of Flow Executions from Azkaban.
173
173
*
174
- * @param URL AzkabanCluster URL
174
+ * @param url AzkabanCluster URL
175
175
* @param execIds List of Azkaban flow execution ids
176
176
* @param sessionId The Azkaban session id
177
177
* @return
178
178
*/
179
- static List<String > batchFetchFlowExecution (String URL , List<String > execIds , String sessionId ) throws Exception {
180
- List<URI > uriList = new ArrayList< URI > ();
179
+ static List<String > batchFetchFlowExecution (String url , List<String > execIds , String sessionId ) throws Exception {
180
+ List<URI > uriList = []
181
181
execIds. each { execId ->
182
- uriList. add(new URIBuilder (URL )
182
+ uriList. add(new URIBuilder (url )
183
183
.setPath(AzkabanParams . EXECUTOR )
184
184
.setParameter(AzkabanParams . SESSIONID , sessionId)
185
185
.setParameter(AzkabanParams . AJAX , " fetchexecflow" )
186
186
.setParameter(AzkabanParams . EXECID , execId)
187
- .build());
187
+ .build())
188
188
}
189
- return HttpUtil . batchGet(uriList);
189
+ return HttpUtil . batchGet(uriList)
190
190
}
191
191
192
192
/**
193
193
* Cancels Flow Execution in Azkaban.
194
194
*
195
- * @param URL AzkabanCluster URL
195
+ * @param url AzkabanCluster URL
196
196
* @param execId Azkaban flow execution id
197
197
* @param sessionId The Azkaban session id
198
198
* @return
199
199
*/
200
- static String cancelFlowExecution (String URL , String execId , String sessionId ) throws Exception {
201
- return HttpUtil . responseFromGET(new URIBuilder (URL )
200
+ static String cancelFlowExecution (String url , String execId , String sessionId ) throws Exception {
201
+ return HttpUtil . responseFromGET(new URIBuilder (url )
202
202
.setPath(AzkabanParams . EXECUTOR )
203
203
.addParameter(AzkabanParams . SESSIONID , sessionId)
204
204
.addParameter(AzkabanParams . AJAX , " cancelFlow" )
205
205
.addParameter(AzkabanParams . EXECID , execId)
206
- .build());
206
+ .build())
207
207
}
208
208
209
209
/**
210
210
* Cancels a batch of Executions in Azkaban.
211
211
*
212
- * @param URL AzkabanCluster URL
212
+ * @param url AzkabanCluster URL
213
213
* @param execIds List of Azkaban flow execution ids
214
214
* @param sessionId The Azkaban session id
215
215
* @return
216
216
*/
217
- static List<String > batchCancelFlowExecution (String URL , Set<String > execIds , String sessionId ) throws Exception {
218
- List<URI > uriList = new ArrayList< URI > ();
217
+ static List<String > batchCancelFlowExecution (String url , Set<String > execIds , String sessionId ) throws Exception {
218
+ List<URI > uriList = []
219
219
execIds. each { execId ->
220
- uriList. add(new URIBuilder (URL )
220
+ uriList. add(new URIBuilder (url )
221
221
.setPath(AzkabanParams . EXECUTOR )
222
222
.addParameter(AzkabanParams . SESSIONID , sessionId)
223
223
.addParameter(AzkabanParams . AJAX , " cancelFlow" )
224
224
.addParameter(AzkabanParams . EXECID , execId)
225
- .build());
225
+ .build())
226
226
}
227
- return HttpUtil . batchGet(uriList);
227
+ return HttpUtil . batchGet(uriList)
228
228
}
229
229
230
230
/**
231
231
* Fetches execIds of Running Executions.
232
232
*
233
- * @param URL AzkabanCluster URL
233
+ * @param url AzkabanCluster URL
234
234
* @param projectName Azkaban Project Name
235
235
* @param flow Flow Name
236
236
* @param sessionId The Azkaban session id
237
237
* @return
238
238
*/
239
- static String getRunningExecutions (String URL , String projectName , String flow , String sessionId ) throws Exception {
240
- return HttpUtil . responseFromGET(new URIBuilder (URL )
239
+ static String getRunningExecutions (String url , String projectName , String flow , String sessionId ) throws Exception {
240
+ return HttpUtil . responseFromGET(new URIBuilder (url )
241
241
.setPath(AzkabanParams . EXECUTOR )
242
242
.addParameter(AzkabanParams . SESSIONID , sessionId)
243
243
.addParameter(AzkabanParams . AJAX , " getRunning" )
244
244
.addParameter(AzkabanParams . PROJECT , projectName)
245
245
.addParameter(AzkabanParams . FLOW , flow)
246
- .build());
246
+ .build())
247
247
}
248
248
249
249
/**
250
250
* Fetches a batch of execIds of Running Executions.
251
251
*
252
- * @param URL AzkabanCluster URL
252
+ * @param url AzkabanCluster URL
253
253
* @param projectName Azkaban Project Name
254
254
* @param flows List of all flows in the Project
255
255
* @param sessionId The Azkaban session id
256
256
* @return
257
257
*/
258
- static List<String > batchGetRunningExecutions (String URL , String projectName , List<String > flows , String sessionId ) throws Exception {
259
- List<URI > uriList = new ArrayList< URI > ();
258
+ static List<String > batchGetRunningExecutions (String url , String projectName , List<String > flows , String sessionId ) throws Exception {
259
+ List<URI > uriList = []
260
260
flows. each { flow ->
261
- uriList. add(new URIBuilder (URL )
261
+ uriList. add(new URIBuilder (url )
262
262
.setPath(AzkabanParams . EXECUTOR )
263
263
.addParameter(AzkabanParams . SESSIONID , sessionId)
264
264
.addParameter(AzkabanParams . AJAX , " getRunning" )
265
265
.addParameter(AzkabanParams . PROJECT , projectName)
266
266
.addParameter(AzkabanParams . FLOW , flow)
267
- .build());
267
+ .build())
268
268
}
269
- return HttpUtil . batchGet(uriList);
269
+ return HttpUtil . batchGet(uriList)
270
270
}
271
271
}
0 commit comments