Skip to content

Commit 9865744

Browse files
Pranay Hasan Yerrapranayyerra
Pranay Hasan Yerra
authored andcommitted
Addressed a bug in ready status in Azkaban client. Cleaned up the codenarc errors in azkaban-client.
1 parent 1ff69e1 commit 9865744

File tree

10 files changed

+245
-238
lines changed

10 files changed

+245
-238
lines changed

CONTRIBUTORS.md

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ The following were contributed by Ragesh Rajagopalan. Thanks, Ragesh!
8484
* `DI-584 Login prompt missing when uploading to Azkaban`
8585

8686
The following were contributed by Pranay Hasan Yerra. Thanks, Pranay!
87+
* `Addressed a bug in ready status. Cleaned up the codenarc errors in azkaban-client`
8788
* `LIHADOOP-33260 Bump to Gradle 4.1`
8889
* `LIHADOOP-26107 Parameters to override the setting in .azkabanPlugin.json`
8990
* `LIHADOOP-16252 Prevent core-site.xml from polluting IDE's classpath`

VERSIONS.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ the License.
1717
Note that the LinkedIn build system occasionally requires that we skip a
1818
version bump, so you will see a few skipped version numbers in the list below.
1919

20+
0.14.1
21+
22+
* Addressed a bug in ready status. Cleaned up the codenarc errors in azkaban-client.
23+
2024
0.14.0
2125

2226
* Bump to Gradle 4.1

azkaban-client/src/main/groovy/com/linkedin/gradle/azkaban/client/AzkabanClient.groovy

+61-61
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
* License for the specific language governing permissions and limitations under
1414
* the License.
1515
*/
16-
package com.linkedin.gradle.azkaban.client;
16+
package com.linkedin.gradle.azkaban.client
1717

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
2020

2121
/**
2222
* Azkaban Client for Azkaban.
@@ -25,247 +25,247 @@ class AzkabanClient {
2525
/**
2626
* Creates a project in Azkaban.
2727
*
28-
* @param URL AzkabanCluster URL
28+
* @param url AzkabanCluster URL
2929
* @param projectName Azkaban Project Name
3030
* @param description Project Description
3131
* @param sessionId The Azkaban session id
3232
* @return
3333
*/
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)
3636
.setPath(AzkabanParams.MANAGER)
3737
.setParameter(AzkabanParams.SESSIONID, sessionId)
3838
.setParameter(AzkabanParams.ACTION, "create")
3939
.setParameter(AzkabanParams.NAME, projectName)
4040
.setParameter(AzkabanParams.DESCRIPTION, description)
41-
.build());
41+
.build())
4242
}
4343

4444
/**
4545
* Executes a flow in Azkaban.
4646
*
47-
* @param URL AzkabanCluster URL
47+
* @param url AzkabanCluster URL
4848
* @param projectName Azkaban Project Name
4949
* @param flow Flow Name
5050
* @param sessionId The Azkaban session id
5151
* @return
5252
*/
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)
5555
.setPath(AzkabanParams.EXECUTOR)
5656
.addParameter(AzkabanParams.SESSIONID, sessionId)
5757
.addParameter(AzkabanParams.AJAX, "executeFlow")
5858
.addParameter(AzkabanParams.PROJECT, projectName)
5959
.addParameter(AzkabanParams.FLOW, flow)
60-
.build());
60+
.build())
6161
}
6262

6363
/**
6464
* Fetches flow Executions from Azkaban.
6565
*
66-
* @param URL AzkabanCluster URL
66+
* @param url AzkabanCluster URL
6767
* @param projectName Azkaban Project Name
6868
* @param flow Flow Name
6969
* @param startIndex Index of execution to start from
7070
* @param endIndex Index of execution to end
7171
* @param sessionId The Azkaban session id
7272
* @return
7373
*/
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)
7676
.setPath(AzkabanParams.MANAGER)
7777
.addParameter(AzkabanParams.SESSIONID, sessionId)
7878
.addParameter(AzkabanParams.AJAX, "fetchFlowExecutions")
7979
.addParameter(AzkabanParams.PROJECT, projectName)
8080
.addParameter(AzkabanParams.FLOW, flow)
8181
.addParameter(AzkabanParams.START, startIndex)
8282
.addParameter(AzkabanParams.LENGTH, endIndex)
83-
.build());
83+
.build())
8484
}
8585

8686
/**
8787
* Fetches all the detailed information of that execution, including a list of all the job executions
8888
* from Azkaban.
8989
*
90-
* @param URL AzkabanCluster URL
90+
* @param url AzkabanCluster URL
9191
* @param execId Azkaban flow execution id
9292
* @param sessionId The Azkaban session id
9393
* @return
9494
*/
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)
9797
.setPath(AzkabanParams.EXECUTOR)
9898
.setParameter(AzkabanParams.SESSIONID, sessionId)
9999
.setParameter(AzkabanParams.AJAX, "fetchexecflow")
100100
.setParameter(AzkabanParams.EXECID, execId)
101-
.build());
101+
.build())
102102
}
103103

104104
/**
105105
* Fetch flows of the project in Azkaban.
106106
*
107-
* @param URL AzkabanCluster URL
107+
* @param url AzkabanCluster URL
108108
* @param projectName Azkaban Project Name
109109
* @param sessionId The Azkaban session id
110110
* @return
111111
*/
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)
114114
.setPath(AzkabanParams.MANAGER)
115115
.addParameter(AzkabanParams.SESSIONID, sessionId)
116116
.addParameter(AzkabanParams.AJAX, "fetchprojectflows")
117117
.addParameter(AzkabanParams.PROJECT, projectName)
118-
.build());
118+
.build())
119119
}
120120

121121
/**
122122
* Executes Multiple flows in Azkaban.
123123
*
124-
* @param URL AzkabanCluster URL
124+
* @param url AzkabanCluster URL
125125
* @param projectName Azkaban Project Name
126126
* @param flows List of all flows in the Project
127127
* @param sessionId The Azkaban session id
128128
* @return
129129
*/
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 {
131131
//Pool HTTP Get requests for executing flows
132-
List<URI> executeUriList = new ArrayList<URI>();
132+
List<URI> executeUriList = []
133133
flows.each { flow ->
134-
executeUriList.add(new URIBuilder(URL)
134+
executeUriList.add(new URIBuilder(url)
135135
.setPath(AzkabanParams.EXECUTOR)
136136
.addParameter(AzkabanParams.SESSIONID, sessionId)
137137
.addParameter(AzkabanParams.AJAX, "executeFlow")
138138
.addParameter(AzkabanParams.PROJECT, projectName)
139139
.addParameter(AzkabanParams.FLOW, flow)
140-
.build());
140+
.build())
141141
}
142-
return HttpUtil.batchGet(executeUriList);
142+
return HttpUtil.batchGet(executeUriList)
143143
}
144144

145145
/**
146146
* Fetches Latest Flow Execution for Multiple flows in Azkaban.
147147
*
148-
* @param URL AzkabanCluster URL
148+
* @param url AzkabanCluster URL
149149
* @param projectName Azkaban Project Name
150150
* @param flows List of Flow names for which latest execution is needed
151151
* @param sessionId The Azkaban session id
152152
* @return List of response containing Latest execution for each flow.
153153
*/
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 {
155155
//Pool HTTP Get requests for getting most recent ExecID for each flow
156-
List<URI> uriList = new ArrayList<URI>();
156+
List<URI> uriList = []
157157
for (String flow : flows) {
158-
uriList.add(new URIBuilder(URL)
158+
uriList.add(new URIBuilder(url)
159159
.setPath(AzkabanParams.MANAGER)
160160
.addParameter(AzkabanParams.SESSIONID, sessionId)
161161
.addParameter(AzkabanParams.AJAX, "fetchFlowExecutions")
162162
.addParameter(AzkabanParams.PROJECT, projectName)
163163
.addParameter(AzkabanParams.FLOW, flow)
164164
.addParameter(AzkabanParams.START, "0")
165165
.addParameter(AzkabanParams.LENGTH, "1")
166-
.build());
166+
.build())
167167
}
168-
return HttpUtil.batchGet(uriList);
168+
return HttpUtil.batchGet(uriList)
169169
}
170170

171171
/**
172172
* Fetches a batch of Flow Executions from Azkaban.
173173
*
174-
* @param URL AzkabanCluster URL
174+
* @param url AzkabanCluster URL
175175
* @param execIds List of Azkaban flow execution ids
176176
* @param sessionId The Azkaban session id
177177
* @return
178178
*/
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 = []
181181
execIds.each { execId ->
182-
uriList.add(new URIBuilder(URL)
182+
uriList.add(new URIBuilder(url)
183183
.setPath(AzkabanParams.EXECUTOR)
184184
.setParameter(AzkabanParams.SESSIONID, sessionId)
185185
.setParameter(AzkabanParams.AJAX, "fetchexecflow")
186186
.setParameter(AzkabanParams.EXECID, execId)
187-
.build());
187+
.build())
188188
}
189-
return HttpUtil.batchGet(uriList);
189+
return HttpUtil.batchGet(uriList)
190190
}
191191

192192
/**
193193
* Cancels Flow Execution in Azkaban.
194194
*
195-
* @param URL AzkabanCluster URL
195+
* @param url AzkabanCluster URL
196196
* @param execId Azkaban flow execution id
197197
* @param sessionId The Azkaban session id
198198
* @return
199199
*/
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)
202202
.setPath(AzkabanParams.EXECUTOR)
203203
.addParameter(AzkabanParams.SESSIONID, sessionId)
204204
.addParameter(AzkabanParams.AJAX, "cancelFlow")
205205
.addParameter(AzkabanParams.EXECID, execId)
206-
.build());
206+
.build())
207207
}
208208

209209
/**
210210
* Cancels a batch of Executions in Azkaban.
211211
*
212-
* @param URL AzkabanCluster URL
212+
* @param url AzkabanCluster URL
213213
* @param execIds List of Azkaban flow execution ids
214214
* @param sessionId The Azkaban session id
215215
* @return
216216
*/
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 = []
219219
execIds.each { execId ->
220-
uriList.add(new URIBuilder(URL)
220+
uriList.add(new URIBuilder(url)
221221
.setPath(AzkabanParams.EXECUTOR)
222222
.addParameter(AzkabanParams.SESSIONID, sessionId)
223223
.addParameter(AzkabanParams.AJAX, "cancelFlow")
224224
.addParameter(AzkabanParams.EXECID, execId)
225-
.build());
225+
.build())
226226
}
227-
return HttpUtil.batchGet(uriList);
227+
return HttpUtil.batchGet(uriList)
228228
}
229229

230230
/**
231231
* Fetches execIds of Running Executions.
232232
*
233-
* @param URL AzkabanCluster URL
233+
* @param url AzkabanCluster URL
234234
* @param projectName Azkaban Project Name
235235
* @param flow Flow Name
236236
* @param sessionId The Azkaban session id
237237
* @return
238238
*/
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)
241241
.setPath(AzkabanParams.EXECUTOR)
242242
.addParameter(AzkabanParams.SESSIONID, sessionId)
243243
.addParameter(AzkabanParams.AJAX, "getRunning")
244244
.addParameter(AzkabanParams.PROJECT, projectName)
245245
.addParameter(AzkabanParams.FLOW, flow)
246-
.build());
246+
.build())
247247
}
248248

249249
/**
250250
* Fetches a batch of execIds of Running Executions.
251251
*
252-
* @param URL AzkabanCluster URL
252+
* @param url AzkabanCluster URL
253253
* @param projectName Azkaban Project Name
254254
* @param flows List of all flows in the Project
255255
* @param sessionId The Azkaban session id
256256
* @return
257257
*/
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 = []
260260
flows.each { flow ->
261-
uriList.add(new URIBuilder(URL)
261+
uriList.add(new URIBuilder(url)
262262
.setPath(AzkabanParams.EXECUTOR)
263263
.addParameter(AzkabanParams.SESSIONID, sessionId)
264264
.addParameter(AzkabanParams.AJAX, "getRunning")
265265
.addParameter(AzkabanParams.PROJECT, projectName)
266266
.addParameter(AzkabanParams.FLOW, flow)
267-
.build());
267+
.build())
268268
}
269-
return HttpUtil.batchGet(uriList);
269+
return HttpUtil.batchGet(uriList)
270270
}
271271
}

azkaban-client/src/main/groovy/com/linkedin/gradle/azkaban/client/AzkabanParams.groovy

+13-13
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
* License for the specific language governing permissions and limitations under
1414
* the License.
1515
*/
16-
package com.linkedin.gradle.azkaban.client;
16+
package com.linkedin.gradle.azkaban.client
1717

1818
class AzkabanParams {
19-
public static final String ACTION = "action";
20-
public static final String AJAX = "ajax";
21-
public static final String DESCRIPTION = "description";
22-
public static final String EXECID = "execid";
23-
public static final String EXECUTOR = "/executor";
24-
public static final String FLOW = "flow";
25-
public static final String LENGTH = "length";
26-
public static final String MANAGER = "/manager";
27-
public static final String NAME = "name";
28-
public static final String PROJECT = "project";
29-
public static final String SESSIONID = "session.id";
30-
public static final String START = "start";
19+
public static final String ACTION = "action"
20+
public static final String AJAX = "ajax"
21+
public static final String DESCRIPTION = "description"
22+
public static final String EXECID = "execid"
23+
public static final String EXECUTOR = "/executor"
24+
public static final String FLOW = "flow"
25+
public static final String LENGTH = "length"
26+
public static final String MANAGER = "/manager"
27+
public static final String NAME = "name"
28+
public static final String PROJECT = "project"
29+
public static final String SESSIONID = "session.id"
30+
public static final String START = "start"
3131
}

0 commit comments

Comments
 (0)