You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by mo...@apache.org on 2013/05/18 01:49:50 UTC
svn commit: r1484029 - in /oozie/branches/branch-4.0: ./
client/src/main/java/org/apache/oozie/cli/
client/src/main/java/org/apache/oozie/client/rest/
client/src/test/java/org/apache/oozie/client/rest/
core/src/main/java/org/apache/oozie/ core/src/main...
Author: mona
Date: Fri May 17 23:49:49 2013
New Revision: 1484029
URL: http://svn.apache.org/r1484029
Log:
OOZIE-1303 CLI API for Bulk Monitoring (mona)
Modified:
oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/rest/JsonToBean.java
oozie/branches/branch-4.0/client/src/test/java/org/apache/oozie/client/rest/TestJsonToBean.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/BundleJobBean.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/client/rest/BulkResponseImpl.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkJPAExecutor.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java
oozie/branches/branch-4.0/docs/src/site/twiki/DG_CommandLineTool.twiki
oozie/branches/branch-4.0/release-log.txt
Modified: oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/cli/OozieCLI.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/cli/OozieCLI.java (original)
+++ oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/cli/OozieCLI.java Fri May 17 23:49:49 2013
@@ -1104,7 +1104,7 @@ public class OozieCLI {
private static final String WORKFLOW_ACTION_FORMATTER = "%-78s%-10s%-23s%-11s%-10s";
private static final String COORD_ACTION_FORMATTER = "%-43s%-10s%-37s%-10s%-21s%-21s";
- private static final String BULK_RESPONSE_FORMATTER = "%-41s%-41s%-37s%-37s%-13s%-21s%-24s";
+ private static final String BULK_RESPONSE_FORMATTER = "%-13s%-38s%-13s%-41s%-10s%-38s%-21s%-38s";
private void printJob(WorkflowJob job, String timeZoneId, boolean verbose) throws IOException {
System.out.println("Job ID : " + maskIfNull(job.getId()));
@@ -1191,7 +1191,7 @@ public class OozieCLI {
try {
if (bulkFilterString != null) {
- printBulkJobs(wc.getBulkInfo(bulkFilterString, start, len), timeZoneId);
+ printBulkJobs(wc.getBulkInfo(bulkFilterString, start, len), timeZoneId, commandLine.hasOption(VERBOSE_OPTION));
}
else if (jobtype.toLowerCase().contains("wf")) {
printJobs(wc.getJobsInfo(filter, start, len), timeZoneId, commandLine.hasOption(VERBOSE_OPTION));
@@ -1255,17 +1255,40 @@ public class OozieCLI {
}
}
- private void printBulkJobs(List<BulkResponse> jobs, String timeZoneId) throws IOException {
+ private void printBulkJobs(List<BulkResponse> jobs, String timeZoneId, boolean verbose) throws IOException {
if (jobs != null && jobs.size() > 0) {
- System.out.println(String.format(BULK_RESPONSE_FORMATTER, "Bundle Name", "Coordinator Name",
- "Coord Action ID", "External ID", "Status", "Created Time", "Error Message"));
-
for (BulkResponse response : jobs) {
- System.out.println(String.format(BULK_RESPONSE_FORMATTER, maskIfNull((response.getBundle()).getAppName()),
- maskIfNull((response.getCoordinator()).getAppName()), maskIfNull((response.getAction()).getId()),
- maskIfNull((response.getAction()).getExternalId()), (response.getAction()).getStatus(),
- maskDate((response.getAction()).getCreatedTime(), timeZoneId, false), (response.getAction()).getErrorMessage()));
- System.out.println(RULER);
+ BundleJob bundle = response.getBundle();
+ CoordinatorJob coord = response.getCoordinator();
+ CoordinatorAction action = response.getAction();
+ if (verbose) {
+ System.out.println();
+ System.out.println("Bundle Name : " + maskIfNull(bundle.getAppName()));
+
+ System.out.println(RULER);
+
+ System.out.println("Bundle ID : " + maskIfNull(bundle.getId()));
+ System.out.println("Coordinator Name : " + maskIfNull(coord.getAppName()));
+ System.out.println("Coord Action ID : " + maskIfNull(action.getId()));
+ System.out.println("Action Status : " + action.getStatus());
+ System.out.println("External ID : " + maskIfNull(action.getExternalId()));
+ System.out.println("Created Time : " + maskDate(action.getCreatedTime(), timeZoneId, false));
+ System.out.println("User : " + maskIfNull(bundle.getUser()));
+ System.out.println("Error Message : " + maskIfNull(action.getErrorMessage()));
+ System.out.println(RULER);
+ }
+ else {
+ System.out.println(String.format(BULK_RESPONSE_FORMATTER, "Bundle Name", "Bundle ID", "Coord Name",
+ "Coord Action ID", "Status", "External ID", "Created Time", "Error Message"));
+ System.out.println(RULER);
+ System.out
+ .println(String.format(BULK_RESPONSE_FORMATTER, maskIfNull(bundle.getAppName()),
+ maskIfNull(bundle.getId()), maskIfNull(coord.getAppName()),
+ maskIfNull(action.getId()), action.getStatus(), maskIfNull(action.getExternalId()),
+ maskDate(action.getCreatedTime(), timeZoneId, false),
+ maskIfNull(action.getErrorMessage())));
+ System.out.println(RULER);
+ }
}
}
else {
Modified: oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/rest/JsonToBean.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/rest/JsonToBean.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/rest/JsonToBean.java (original)
+++ oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/rest/JsonToBean.java Fri May 17 23:49:49 2013
@@ -41,6 +41,7 @@ import java.util.Map;
* <p/>
* It uses JDK dynamic proxy to create bean instances.
*/
+@SuppressWarnings("rawtypes")
public class JsonToBean {
private static class Property {
@@ -174,9 +175,9 @@ public class JsonToBean {
BUNDLE_JOB.put("getCoordinators",new Property(JsonTags.BUNDLE_COORDINATOR_JOBS, CoordinatorJob.class, true));
BUNDLE_JOB.put("toString", new Property(JsonTags.TO_STRING, String.class));
- BULK_RESPONSE.put("getBundle", new Property(JsonTags.BULK_RESPONSE_BUNDLE, BundleJob.class, true));
- BULK_RESPONSE.put("getCoordinator", new Property(JsonTags.BULK_RESPONSE_COORDINATOR, CoordinatorJob.class, true));
- BULK_RESPONSE.put("getAction", new Property(JsonTags.BULK_RESPONSE_ACTION, CoordinatorAction.class, true));
+ BULK_RESPONSE.put("getBundle", new Property(JsonTags.BULK_RESPONSE_BUNDLE, BundleJob.class, false));
+ BULK_RESPONSE.put("getCoordinator", new Property(JsonTags.BULK_RESPONSE_COORDINATOR, CoordinatorJob.class, false));
+ BULK_RESPONSE.put("getAction", new Property(JsonTags.BULK_RESPONSE_ACTION, CoordinatorAction.class, false));
}
@@ -243,6 +244,15 @@ public class JsonToBean {
else if (type == WorkflowAction.class) {
return createWorkflowAction((JSONObject) obj);
}
+ else if (type == CoordinatorJob.class) {
+ return createCoordinatorJob((JSONObject) obj);
+ }
+ else if (type == CoordinatorAction.class) {
+ return createCoordinatorAction((JSONObject) obj);
+ }
+ else if (type == BundleJob.class) {
+ return createBundleJob((JSONObject) obj);
+ }
else {
throw new RuntimeException("Unsupported type : " + type.getSimpleName());
}
@@ -380,6 +390,18 @@ public class JsonToBean {
}
/**
+ * Creates a Bulk response object from a JSON object.
+ *
+ * @param json json object.
+ * @return a Bulk response object populated with the JSON object values.
+ */
+ public static BulkResponse createBulkResponse(JSONObject json) {
+ return (BulkResponse) Proxy.newProxyInstance(JsonToBean.class.getClassLoader(),
+ new Class[]{BulkResponse.class},
+ new JsonInvocationHandler(BULK_RESPONSE, json));
+ }
+
+ /**
* Creates a list of bulk response beans from a JSON array.
*
* @param json json array.
@@ -388,11 +410,9 @@ public class JsonToBean {
public static List<BulkResponse> createBulkResponseList(JSONArray json) {
List<BulkResponse> list = new ArrayList<BulkResponse>();
for (Object obj : json) {
- BulkResponse bulkObj = (BulkResponse) Proxy.newProxyInstance
- (JsonToBean.class.getClassLoader(), new Class[]{BulkResponse.class},
- new JsonInvocationHandler(BULK_RESPONSE, (JSONObject) obj));
- list.add(bulkObj);
+ list.add(createBulkResponse((JSONObject) obj));
}
return list;
}
+
}
Modified: oozie/branches/branch-4.0/client/src/test/java/org/apache/oozie/client/rest/TestJsonToBean.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/client/src/test/java/org/apache/oozie/client/rest/TestJsonToBean.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/client/src/test/java/org/apache/oozie/client/rest/TestJsonToBean.java (original)
+++ oozie/branches/branch-4.0/client/src/test/java/org/apache/oozie/client/rest/TestJsonToBean.java Fri May 17 23:49:49 2013
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,6 +18,9 @@
package org.apache.oozie.client.rest;
import junit.framework.TestCase;
+
+import org.apache.oozie.client.BulkResponse;
+import org.apache.oozie.client.BundleJob;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.client.CoordinatorJob;
import org.apache.oozie.client.WorkflowAction;
@@ -312,4 +315,85 @@ public class TestJsonToBean extends Test
assertEquals("cj2", list.get(1).getId());
}
+ @SuppressWarnings("unchecked")
+ private JSONObject createJsonBulkResponse() {
+ JSONObject bulk = new JSONObject();
+ JSONObject bundle = new JSONObject();
+ JSONObject coord = createJsonCoordinatorJob();
+ JSONObject action = createJsonCoordinatorAction();
+
+ bundle.put(JsonTags.BUNDLE_JOB_NAME, "bundle-app");
+ bundle.put(JsonTags.BUNDLE_JOB_ID, "bundle-id");
+ bundle.put(JsonTags.BUNDLE_JOB_STATUS, BundleJob.Status.RUNNING.name());
+ coord.put(JsonTags.COORDINATOR_JOB_NAME, "coord-app");
+ coord.put(JsonTags.COORDINATOR_JOB_STATUS, CoordinatorJob.Status.SUSPENDED.name());
+ action.put(JsonTags.COORDINATOR_ACTION_ID, "action-id");
+ action.put(JsonTags.COORDINATOR_JOB_ID, "coord-id");
+ action.put(JsonTags.COORDINATOR_ACTION_NUMBER, (long)1);
+ action.put(JsonTags.COORDINATOR_ACTION_EXTERNALID, "action-externalId");
+ action.put(JsonTags.COORDINATOR_ACTION_STATUS, CoordinatorAction.Status.FAILED.name());
+ action.put(JsonTags.COORDINATOR_ACTION_EXTERNAL_STATUS, "action-externalStatus");
+ action.put(JsonTags.COORDINATOR_ACTION_ERROR_CODE, "action-errorCode");
+ action.put(JsonTags.COORDINATOR_ACTION_ERROR_MESSAGE, "action-errorMessage");
+ action.put(JsonTags.COORDINATOR_ACTION_CREATED_TIME, CREATED_TIME);
+ action.put(JsonTags.COORDINATOR_ACTION_NOMINAL_TIME, NOMINAL_TIME);
+ action.put(JsonTags.COORDINATOR_ACTION_MISSING_DEPS, "action-missingDeps");
+
+ bulk.put(JsonTags.BULK_RESPONSE_BUNDLE, bundle);
+ bulk.put(JsonTags.BULK_RESPONSE_COORDINATOR, coord);
+ bulk.put(JsonTags.BULK_RESPONSE_ACTION, action);
+ return bulk;
+ }
+
+ @SuppressWarnings("unchecked")
+ private JSONArray createJsonBulkResponseList() {
+ JSONObject json1 = createJsonBulkResponse();
+ JSONObject coord1 = (JSONObject) json1.get(JsonTags.BULK_RESPONSE_COORDINATOR);
+ coord1.put(JsonTags.COORDINATOR_JOB_ID, "cj1");
+ JSONObject json2 = createJsonBulkResponse();
+ JSONObject coord2 = (JSONObject) json2.get(JsonTags.BULK_RESPONSE_COORDINATOR);
+ coord2.put(JsonTags.COORDINATOR_JOB_ID, "cj2");
+ JSONArray array = new JSONArray();
+ array.add(json1);
+ array.add(json2);
+ return array;
+ }
+
+ public void testParseBulkResponse() {
+ JSONObject json = createJsonBulkResponse();
+
+ BundleJob bulkBundle = JsonToBean.createBundleJob((JSONObject) json.get(JsonTags.BULK_RESPONSE_BUNDLE));
+ CoordinatorJob bulkCoord = JsonToBean.createCoordinatorJob((JSONObject) json.get(JsonTags.BULK_RESPONSE_COORDINATOR));
+ CoordinatorAction bulkAction = JsonToBean.createCoordinatorAction((JSONObject) json.get(JsonTags.BULK_RESPONSE_ACTION));
+
+ assertNotNull(bulkBundle);
+ assertNotNull(bulkCoord);
+ assertNotNull(bulkAction);
+ assertEquals("bundle-app", bulkBundle.getAppName());
+ assertEquals("bundle-id", bulkBundle.getId());
+ assertEquals(BundleJob.Status.RUNNING, bulkBundle.getStatus());
+ assertEquals("coord-app", bulkCoord.getAppName());
+ assertEquals(CoordinatorJob.Status.SUSPENDED, bulkCoord.getStatus());
+ assertEquals("action-id", bulkAction.getId());
+ assertEquals("coord-id", bulkAction.getJobId());
+ assertEquals(1, bulkAction.getActionNumber());
+ assertEquals("action-externalId", bulkAction.getExternalId());
+ assertEquals(CoordinatorAction.Status.FAILED, bulkAction.getStatus());
+ assertEquals("action-externalStatus", bulkAction.getExternalStatus());
+ assertEquals("action-errorCode", bulkAction.getErrorCode());
+ assertEquals("action-errorMessage", bulkAction.getErrorMessage());
+ assertEquals(JsonUtils.parseDateRfc822(CREATED_TIME), bulkAction.getCreatedTime());
+ assertEquals(JsonUtils.parseDateRfc822(NOMINAL_TIME), bulkAction.getNominalTime());
+ assertEquals("action-missingDeps", bulkAction.getMissingDependencies());
+ }
+
+ public void testParseBulkResponseList() {
+ JSONArray array = createJsonBulkResponseList();
+ List<BulkResponse> list = JsonToBean.createBulkResponseList(array);
+
+ assertEquals(2, list.size());
+ assertEquals("cj1", list.get(0).getCoordinator().getId());
+ assertEquals("cj2", list.get(1).getCoordinator().getId());
+ }
+
}
Modified: oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/BundleJobBean.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/BundleJobBean.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/BundleJobBean.java (original)
+++ oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/BundleJobBean.java Fri May 17 23:49:49 2013
@@ -68,7 +68,7 @@ import org.apache.openjpa.persistence.jd
@NamedQuery(name = "GET_COMPLETED_BUNDLE_JOBS_OLDER_THAN", query = "select OBJECT(w) from BundleJobBean w where ( w.status = 'SUCCEEDED' OR w.status = 'FAILED' OR w.status = 'KILLED' OR w.status = 'DONEWITHERROR') AND w.lastModifiedTimestamp <= :lastModTime order by w.lastModifiedTimestamp"),
- @NamedQuery(name = "BULK_MONITOR_BUNDLE_QUERY", query = "SELECT b.id, b.status FROM BundleJobBean b WHERE b.appName = :appName"),
+ @NamedQuery(name = "BULK_MONITOR_BUNDLE_QUERY", query = "SELECT b.id, b.status, b.user FROM BundleJobBean b WHERE b.appName = :appName"),
// Join query
@NamedQuery(name = "BULK_MONITOR_ACTIONS_QUERY", query = "SELECT a.id, a.actionNumber, a.errorCode, a.errorMessage, a.externalId, " +
Modified: oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/client/rest/BulkResponseImpl.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/client/rest/BulkResponseImpl.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/client/rest/BulkResponseImpl.java (original)
+++ oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/client/rest/BulkResponseImpl.java Fri May 17 23:49:49 2013
@@ -80,25 +80,6 @@ public class BulkResponseImpl implements
json.put(JsonTags.BULK_RESPONSE_COORDINATOR, coordinator.toJSONObject());
json.put(JsonTags.BULK_RESPONSE_ACTION, action.toJSONObject());
- json.put(JsonTags.BUNDLE_JOB_NAME, bundle.getAppName());
- json.put(JsonTags.BUNDLE_JOB_ID, bundle.getId());
- json.put(JsonTags.BUNDLE_JOB_STATUS, bundle.getStatus().toString());
-
- json.put(JsonTags.COORDINATOR_JOB_NAME, coordinator.getAppName());
- json.put(JsonTags.COORDINATOR_JOB_STATUS, coordinator.getStatus().toString());
-
- json.put(JsonTags.COORDINATOR_ACTION_ID, action.getId());
- json.put(JsonTags.COORDINATOR_JOB_ID, action.getJobId());
- json.put(JsonTags.COORDINATOR_ACTION_NUMBER, action.getActionNumber());
- json.put(JsonTags.COORDINATOR_ACTION_EXTERNALID, action.getExternalId());
- json.put(JsonTags.COORDINATOR_ACTION_STATUS, action.getStatus().toString());
- json.put(JsonTags.COORDINATOR_ACTION_EXTERNAL_STATUS, action.getExternalStatus());
- json.put(JsonTags.COORDINATOR_ACTION_ERROR_CODE, action.getErrorCode());
- json.put(JsonTags.COORDINATOR_ACTION_ERROR_MESSAGE, action.getErrorMessage());
- json.put(JsonTags.COORDINATOR_ACTION_CREATED_TIME, action.getCreatedTime().toString());
- json.put(JsonTags.COORDINATOR_ACTION_NOMINAL_TIME, action.getNominalTime().toString());
- json.put(JsonTags.COORDINATOR_ACTION_MISSING_DEPS, action.getMissingDependencies());
-
return json;
}
Modified: oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkJPAExecutor.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkJPAExecutor.java (original)
+++ oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkJPAExecutor.java Fri May 17 23:49:49 2013
@@ -294,6 +294,9 @@ public class BulkJPAExecutor implements
if (barr[1] != null) {
bean.setStatus(BundleJob.Status.valueOf((String) barr[1]));
}
+ if (barr[2] != null) {
+ bean.setUser((String) barr[2]);
+ }
return bean;
}
Modified: oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java (original)
+++ oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java Fri May 17 23:49:49 2013
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -303,7 +303,7 @@ public class V1JobsServlet extends BaseJ
String filter = request.getParameter(RestConstants.JOBS_FILTER_PARAM);
String startStr = request.getParameter(RestConstants.OFFSET_PARAM);
String lenStr = request.getParameter(RestConstants.LEN_PARAM);
- String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
+ String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
? "GMT" : request.getParameter(RestConstants.TIME_ZONE_PARAM);
int start = (startStr != null) ? Integer.parseInt(startStr) : 1;
start = (start < 1) ? 1 : start;
@@ -337,7 +337,7 @@ public class V1JobsServlet extends BaseJ
String filter = request.getParameter(RestConstants.JOBS_FILTER_PARAM);
String startStr = request.getParameter(RestConstants.OFFSET_PARAM);
String lenStr = request.getParameter(RestConstants.LEN_PARAM);
- String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
+ String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
? "GMT" : request.getParameter(RestConstants.TIME_ZONE_PARAM);
int start = (startStr != null) ? Integer.parseInt(startStr) : 1;
start = (start < 1) ? 1 : start;
@@ -366,7 +366,7 @@ public class V1JobsServlet extends BaseJ
String filter = request.getParameter(RestConstants.JOBS_FILTER_PARAM);
String startStr = request.getParameter(RestConstants.OFFSET_PARAM);
String lenStr = request.getParameter(RestConstants.LEN_PARAM);
- String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
+ String timeZoneId = request.getParameter(RestConstants.TIME_ZONE_PARAM) == null
? "GMT" : request.getParameter(RestConstants.TIME_ZONE_PARAM);
int start = (startStr != null) ? Integer.parseInt(startStr) : 1;
start = (start < 1) ? 1 : start;
@@ -407,9 +407,9 @@ public class V1JobsServlet extends BaseJ
BundleEngine bundleEngine = Services.get().get(BundleEngineService.class).getBundleEngine(getUser(request),
getAuthToken(request));
BulkResponseInfo bulkResponse = bundleEngine.getBulkJobs(bulkFilter, start, len);
- List<BulkResponseImpl> jsonResponse = bulkResponse.getResponses();
+ List<BulkResponseImpl> responsesToJson = bulkResponse.getResponses();
- json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(jsonResponse, timeZoneId));
+ json.put(JsonTags.BULK_RESPONSES, BulkResponseImpl.toJSONArray(responsesToJson, timeZoneId));
json.put(JsonTags.BULK_RESPONSE_TOTAL, bulkResponse.getTotal());
json.put(JsonTags.BULK_RESPONSE_OFFSET, bulkResponse.getStart());
json.put(JsonTags.BULK_RESPONSE_LEN, bulkResponse.getLen());
Modified: oozie/branches/branch-4.0/docs/src/site/twiki/DG_CommandLineTool.twiki
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/docs/src/site/twiki/DG_CommandLineTool.twiki?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/docs/src/site/twiki/DG_CommandLineTool.twiki (original)
+++ oozie/branches/branch-4.0/docs/src/site/twiki/DG_CommandLineTool.twiki Fri May 17 23:49:49 2013
@@ -617,17 +617,79 @@ Example:
<verbatim>
$ oozie jobs -oozie http://localhost:11000/oozie -jobtype bundle
Job ID Bundle Name Status Kickoff Created User Group
-------------------------------------------------------------------------------------------------------------------------------------
+.------------------------------------------------------------------------------------------------------------------------------------
0000027-110322105610515-oozie-chao-B BUNDLE-TEST RUNNING 2012-01-15 00:24 2011-03-22 18:07 joe users
-------------------------------------------------------------------------------------------------------------------------------------
+.------------------------------------------------------------------------------------------------------------------------------------
0000001-110322105610515-oozie-chao-B BUNDLE-TEST RUNNING 2012-01-15 00:24 2011-03-22 18:06 joe users
-------------------------------------------------------------------------------------------------------------------------------------
+.------------------------------------------------------------------------------------------------------------------------------------
0000000-110322105610515-oozie-chao-B BUNDLE-TEST DONEWITHERROR2012-01-15 00:24 2011-03-22 17:58 joe users
-------------------------------------------------------------------------------------------------------------------------------------
+.------------------------------------------------------------------------------------------------------------------------------------
</verbatim>
The =jobtype= option specified the job type to display, default value is 'wf'. To see the bundle jobs, value is 'bundle'.
+---+++ Bulk monitoring for jobs launched via Bundles
+
+* This command-line query helps to directly query for a bulk of jobs using a set of rich filters.
+The jobs need to have a parent *Bundle*, and this performs a deep query to provide results about all the workflows that satisfy your filters.
+These results display relevant job-ids, app-names, and error message (if any) and are most helpful when you need to monitor a bulk of jobs and get a gist,
+while avoiding typing multiple queries.
+
+This feature is only supported in Oozie 3.3 or later.
+
+Example 1:
+
+<verbatim>
+$ oozie jobs -oozie http://localhost:11000/oozie -bulk bundle=bundle-app-1
+.
+Bundle Name Bundle ID Coord Name Coord Action ID External ID Status Created Time Error Message
+.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+bundle-app-1 0000000-130408151805946-oozie-chit-B coord-1 0000001-130408151805946-oozie-chit-C@1 0000002-130408151805946-oozie-chit-W KILLED 2013-04-08 22:20 GMT null
+.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+</verbatim>
+
+Example 2: This example illustrates giving multiple arguments and -verbose option.
+
+_NOTE: The filter string after -bulk should be enclosed within quotes_
+
+<verbatim>
+.
+$ oozie jobs -oozie http://localhost:11000/oozie -bulk 'bundle=bundle-app-2;actionstatus=SUCCEEDED' -verbose
+.
+Bundle Name : bundle-app-2
+.------------------------------------------------------------------------------------------------------------------------------------
+Bundle ID : 0000000-130422184245158-oozie-chit-B
+Coordinator Name : coord-1
+Coord Action ID : 0000001-130422184245158-oozie-chit-C@1
+Action Status : SUCCEEDED
+External ID : 0000002-130422184245158-oozie-chit-W
+Created Time : 2013-04-23 01:43 GMT
+User : user_xyz
+Error Message : -
+.------------------------------------------------------------------------------------------------------------------------------------
+</verbatim>
+
+You can type 'help' to view usage for the CLI options and filters available. Namely:
+
+ * bundle: Bundle app-name (mandatory)
+ * coordinators: multiple, comma-separated Coordinator app-names. By default, if none specified, all coordinators pertaining to the bundle are included
+ * actionstatus: status of jobs (default job-type is coordinator action aka workflow job) you wish to filter on. Default value is (KILLED,FAILED)
+ * startcreatedtime/endcreatedtime: specify boundaries for the created-time. Only jobs created within this window are included.
+ * startscheduledtime/endscheduledtime: specify boundaries for the nominal-time. Only jobs scheduled to run within this window are included.
+
+<verbatim>
+$ oozie jobs <OPTIONS> : jobs status
+ -bulk <arg> key-value pairs to filter bulk jobs response. e.g.
+ bundle=<B>\;coordinators=<C>\;actionstatus=<S>\;
+ startcreatedtime=<SC>\;endcreatedtime=<EC>\;
+ startscheduledtime=<SS>\;endscheduledtime=<ES>\;
+ coordinators and actionstatus can be multiple comma
+ separated values. "bundle" and "coordinators" are 'names' of those jobs.
+ Bundle name is mandatory, other params are optional
+</verbatim>
+
+Similar to the usual jobs filter, different filter arguments here should be separated by semicolon (;).
+
---++ Admin Operations
---+++ Checking the Status of the Oozie System
Modified: oozie/branches/branch-4.0/release-log.txt
URL: http://svn.apache.org/viewvc/oozie/branches/branch-4.0/release-log.txt?rev=1484029&r1=1484028&r2=1484029&view=diff
==============================================================================
--- oozie/branches/branch-4.0/release-log.txt (original)
+++ oozie/branches/branch-4.0/release-log.txt Fri May 17 23:49:49 2013
@@ -1,5 +1,6 @@
-- Oozie 4.0.0 (unreleased)
+OOZIE-1303 CLI API for Bulk Monitoring (mona)
OOZIE-1350 Improve client debug output information (rkanter)
OOZIE-1343 Sqoop sharelib should have hsqldb jar (rkanter)
OOZIE-1344 We should use Sqoop 1.4.3 instead of 1.5.0-incubating-SNAPSHOT (rkanter)