You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by an...@apache.org on 2012/01/06 22:58:33 UTC
svn commit: r1228453 - in /incubator/oozie/branches/3.1: ./
core/src/main/java/org/apache/oozie/
core/src/main/java/org/apache/oozie/util/
core/src/test/java/org/apache/oozie/util/
Author: angeloh
Date: Fri Jan 6 21:58:33 2012
New Revision: 1228453
URL: http://svn.apache.org/viewvc?rev=1228453&view=rev
Log:
OOZIE-553 Ability to view log for coordinator actions that ran in a date range.(Mona via Mohammad)
Modified:
incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/CoordinatorEngine.java
incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/ErrorCode.java
incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java
incubator/oozie/branches/3.1/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java
incubator/oozie/branches/3.1/release-log.txt
Modified: incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/CoordinatorEngine.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/CoordinatorEngine.java?rev=1228453&r1=1228452&r2=1228453&view=diff
==============================================================================
--- incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/CoordinatorEngine.java (original)
+++ incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/CoordinatorEngine.java Fri Jan 6 21:58:33 2012
@@ -373,7 +373,13 @@ public class CoordinatorEngine extends B
// if coordinator action logs are to be retrieved based on date range
// this block gets the corresponding list of coordinator actions to be used by the log filter
if (logRetrievalType.equalsIgnoreCase(RestConstants.JOB_LOG_DATE)) {
- List<CoordinatorActionBean> actionsList = CoordActionsInDateRange.getCoordActionsFromDates(jobId, logRetrievalScope);
+ List<CoordinatorActionBean> actionsList = null;
+ try {
+ actionsList = CoordActionsInDateRange.getCoordActionsFromDates(jobId, logRetrievalScope);
+ }
+ catch (XException xe) {
+ throw new CommandException(ErrorCode.E0302, "Error in date range for coordinator actions", xe);
+ }
StringBuilder commaSeparatedActions = new StringBuilder("");
boolean commaRequired = false;
for (CoordinatorActionBean coordAction : actionsList) {
Modified: incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/ErrorCode.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/ErrorCode.java?rev=1228453&r1=1228452&r2=1228453&view=diff
==============================================================================
--- incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/ErrorCode.java (original)
+++ incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/ErrorCode.java Fri Jan 6 21:58:33 2012
@@ -62,6 +62,7 @@ public enum ErrorCode {
E0305(XLog.STD, "Missing parameter [{0}]"),
E0306(XLog.STD, "Invalid parameter"),
E0307(XLog.STD, "Runtime error [{0}]"),
+ E0308(XLog.STD, "Could not parse date range parameter [{0}]"),
E0400(XLog.STD, "User mismatch, request user [{0}] configuration user [{1}]"),
Modified: incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java?rev=1228453&r1=1228452&r2=1228453&view=diff
==============================================================================
--- incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java (original)
+++ incubator/oozie/branches/3.1/core/src/main/java/org/apache/oozie/util/CoordActionsInDateRange.java Fri Jan 6 21:58:33 2012
@@ -52,7 +52,7 @@ public class CoordActionsInDateRange {
*
* Internally involves a database operation by invoking method 'getActionIdsFromDateRange'.
*/
- public static List<CoordinatorActionBean> getCoordActionsFromDates(String jobId, String scope) throws XException,Exception {
+ public static List<CoordinatorActionBean> getCoordActionsFromDates(String jobId, String scope) throws XException {
ParamChecker.notEmpty(jobId, "jobId");
ParamChecker.notEmpty(scope, "scope");
Set<CoordinatorActionBean> actionSet = new HashSet<CoordinatorActionBean>();
@@ -63,20 +63,25 @@ public class CoordActionsInDateRange {
if (s.contains("::")) {
String[] dateRange = s.split("::");
if (dateRange.length != 2) {
- throw new XException(ErrorCode.E0302, "Error in parsing date's range '" + s + "'. Date value expected on both sides of the scope resolution operator '::' to signify start and end of range");
+ throw new XException(ErrorCode.E0308, "'" + s + "'. Date value expected on both sides of the scope resolution operator '::' to signify start and end of range");
}
Date start;
Date end;
+ try {
start = DateUtils.parseDateUTC(dateRange[0].trim());
end = DateUtils.parseDateUTC(dateRange[1].trim());
+ }
+ catch (Exception dx) {
+ throw new XException(ErrorCode.E0308, "Error in parsing start or end date");
+ }
if (start.after(end)) {
- throw new XException(ErrorCode.E0302, "Error in parsing date's range '" + s + "'. Start date '" + start + "' is older than end date: '" + end + "'");
+ throw new XException(ErrorCode.E0308, "'" + s + "'. Start date '" + start + "' is older than end date: '" + end + "'");
}
List<CoordinatorActionBean> listOfActions = getActionIdsFromDateRange(jobId, start, end);
actionSet.addAll(listOfActions);
}
else {
- throw new XException(ErrorCode.E0302, "Error in parsing date's range '" + s + "'. Separator '::' is missing for start and end dates of range");
+ throw new XException(ErrorCode.E0308, "'" + s + "'. Separator '::' is missing for start and end dates of range");
}
}
List<CoordinatorActionBean> coordActions = new ArrayList<CoordinatorActionBean>();
Modified: incubator/oozie/branches/3.1/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/3.1/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java?rev=1228453&r1=1228452&r2=1228453&view=diff
==============================================================================
--- incubator/oozie/branches/3.1/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java (original)
+++ incubator/oozie/branches/3.1/core/src/test/java/org/apache/oozie/util/TestCoordActionsInDateRange.java Fri Jan 6 21:58:33 2012
@@ -67,13 +67,13 @@ public class TestCoordActionsInDateRange
long noOfMillisecondsinOneHour = 3600000;
// Testing for the number of coordinator actions in a date range that spans from half an hour prior to the nominal time to 1 hour after the nominal time
- String date1 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds - noOfMillisecondsinOneHour / 2));
+ String date1 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds - (noOfMillisecondsinOneHour / 2)));
String date2 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds + noOfMillisecondsinOneHour));
int noOfActions = CoordActionsInDateRange.getCoordActionsFromDates(job.getId().toString(), date1 + "::" + date2).size();
assertEquals(1, noOfActions);
// Testing for the number of coordinator actions in a date range that spans from half an hour after the nominal time to 1 hour after the nominal time
- date1 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds + noOfMillisecondsinOneHour / 2));
+ date1 = DateUtils.formatDateUTC(new Date(nominalTimeMilliseconds + (noOfMillisecondsinOneHour / 2)));
noOfActions = CoordActionsInDateRange.getCoordActionsFromDates(job.getId().toString(), date1 + "::" + date2).size();
assertEquals(0, noOfActions);
}
Modified: incubator/oozie/branches/3.1/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/branches/3.1/release-log.txt?rev=1228453&r1=1228452&r2=1228453&view=diff
==============================================================================
--- incubator/oozie/branches/3.1/release-log.txt (original)
+++ incubator/oozie/branches/3.1/release-log.txt Fri Jan 6 21:58:33 2012
@@ -2,7 +2,7 @@
OOZIE-553 Ability to view log for coordinator actions that ran in a date range.
OOZIE-581 Fix unit test failure in TestStatusTransitService.java.
-OOZIE-579 POM file changes for oozie version 3.1.2
+OOZIE-579 POM file changes for oozie version 3.1.2.
OOZIE-26 Ability to get the log content from Archived file(.gz format)
OOZIE-554 New filters for all kinds of jobs
OOZIE-556 Sort on Web Console for non-string data type