You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ka...@apache.org on 2011/10/18 00:33:21 UTC
svn commit: r1185407 - in /incubator/oozie/trunk:
client/src/main/java/org/apache/oozie/cli/OozieCLI.java
client/src/main/java/org/apache/oozie/client/rest/RestConstants.java
core/src/main/java/org/apache/oozie/CoordinatorEngine.java release-log.txt
Author: kamrul
Date: Mon Oct 17 22:33:20 2011
New Revision: 1185407
URL: http://svn.apache.org/viewvc?rev=1185407&view=rev
Log:
OOZIE-553 Ability to view log for coordinator actions that ran in a date range.(Kiran via Mona via Mohammad)
Modified:
incubator/oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
incubator/oozie/trunk/client/src/main/java/org/apache/oozie/client/rest/RestConstants.java
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorEngine.java
incubator/oozie/trunk/release-log.txt
Modified: incubator/oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java?rev=1185407&r1=1185406&r2=1185407&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java (original)
+++ incubator/oozie/trunk/client/src/main/java/org/apache/oozie/cli/OozieCLI.java Mon Oct 17 22:33:20 2011
@@ -111,7 +111,7 @@ public class OozieCLI {
public static final String LOCAL_TIME_OPTION = "localtime";
public static final String QUEUE_DUMP_OPTION = "queuedump";
public static final String RERUN_COORD_OPTION = "coordinator";
- public static final String RERUN_DATE_OPTION = "date";
+ public static final String DATE_OPTION = "date";
public static final String RERUN_REFRESH_OPTION = "refresh";
public static final String RERUN_NOCLEANUP_OPTION = "nocleanup";
@@ -208,8 +208,8 @@ public class OozieCLI {
Option verbose = new Option(VERBOSE_OPTION, false, "verbose mode");
Option action = new Option(ACTION_OPTION, true,
"coordinator rerun on action ids (requires -rerun); coordinator log retrieval on action ids (requires -log)");
- Option rerun_date = new Option(RERUN_DATE_OPTION, true,
- "coordinator/bundle rerun on action dates (requires -rerun)");
+ Option date = new Option(DATE_OPTION, true,
+ "coordinator/bundle rerun on action dates (requires -rerun); coordinator log retrieval on action dates (requires -log)");
Option rerun_coord = new Option(RERUN_COORD_OPTION, true, "bundle rerun on coordinator names (requires -rerun)");
Option rerun_refresh = new Option(RERUN_REFRESH_OPTION, false,
"re-materialize the coordinator rerun actions (requires -rerun)");
@@ -243,7 +243,7 @@ public class OozieCLI {
jobOptions.addOption(offset);
jobOptions.addOption(len);
jobOptions.addOption(action);
- jobOptions.addOption(rerun_date);
+ jobOptions.addOption(date);
jobOptions.addOption(rerun_coord);
jobOptions.addOption(rerun_refresh);
jobOptions.addOption(rerun_nocleanup);
@@ -612,8 +612,8 @@ public class OozieCLI {
throw new OozieCLIException("Invalid options provided for bundle rerun. " + ACTION_OPTION
+ " is not valid for bundle rerun");
}
- if (options.contains(RERUN_DATE_OPTION)) {
- dateScope = commandLine.getOptionValue(RERUN_DATE_OPTION);
+ if (options.contains(DATE_OPTION)) {
+ dateScope = commandLine.getOptionValue(DATE_OPTION);
}
if (options.contains(RERUN_COORD_OPTION)) {
@@ -642,20 +642,20 @@ public class OozieCLI {
String rerunType = null;
boolean refresh = false;
boolean noCleanup = false;
- if (options.contains(RERUN_DATE_OPTION) && options.contains(ACTION_OPTION)) {
- throw new OozieCLIException("Invalid options provided for rerun: either" + RERUN_DATE_OPTION
- + " or " + ACTION_OPTION + " expected. Don't use both at the same time.");
+ if (options.contains(DATE_OPTION) && options.contains(ACTION_OPTION)) {
+ throw new OozieCLIException("Invalid options provided for rerun: either" + DATE_OPTION + " or "
+ + ACTION_OPTION + " expected. Don't use both at the same time.");
}
- if (options.contains(RERUN_DATE_OPTION)) {
+ if (options.contains(DATE_OPTION)) {
rerunType = RestConstants.JOB_COORD_RERUN_DATE;
- scope = commandLine.getOptionValue(RERUN_DATE_OPTION);
+ scope = commandLine.getOptionValue(DATE_OPTION);
}
else if (options.contains(ACTION_OPTION)) {
rerunType = RestConstants.JOB_COORD_RERUN_ACTION;
scope = commandLine.getOptionValue(ACTION_OPTION);
}
else {
- throw new OozieCLIException("Invalid options provided for rerun: " + RERUN_DATE_OPTION + " or "
+ throw new OozieCLIException("Invalid options provided for rerun: " + DATE_OPTION + " or "
+ ACTION_OPTION + " expected.");
}
if (options.contains(RERUN_REFRESH_OPTION)) {
@@ -708,6 +708,10 @@ public class OozieCLI {
logRetrievalType = RestConstants.JOB_LOG_ACTION;
logRetrievalScope = commandLine.getOptionValue(ACTION_OPTION);
}
+ if (options.contains(DATE_OPTION)) {
+ logRetrievalType = RestConstants.JOB_LOG_DATE;
+ logRetrievalScope = commandLine.getOptionValue(DATE_OPTION);
+ }
try {
wc.getJobLog(commandLine.getOptionValue(LOG_OPTION), logRetrievalType, logRetrievalScope, ps);
}
@@ -716,12 +720,12 @@ public class OozieCLI {
}
}
else {
- if (!options.contains(ACTION_OPTION)) {
+ if (!options.contains(ACTION_OPTION) && !options.contains(DATE_OPTION)) {
wc.getJobLog(commandLine.getOptionValue(LOG_OPTION), null, null, ps);
}
else {
throw new OozieCLIException("Invalid options provided for log retrieval. " + ACTION_OPTION
- + " is valid only for coordinator job log retrieval");
+ + " and " + DATE_OPTION + " are valid only for coordinator job log retrieval");
}
}
}
Modified: incubator/oozie/trunk/client/src/main/java/org/apache/oozie/client/rest/RestConstants.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/client/src/main/java/org/apache/oozie/client/rest/RestConstants.java?rev=1185407&r1=1185406&r2=1185407&view=diff
==============================================================================
--- incubator/oozie/trunk/client/src/main/java/org/apache/oozie/client/rest/RestConstants.java (original)
+++ incubator/oozie/trunk/client/src/main/java/org/apache/oozie/client/rest/RestConstants.java Mon Oct 17 22:33:20 2011
@@ -93,6 +93,8 @@ public interface RestConstants {
public static final String JOB_LOG_ACTION = "action";
+ public static final String JOB_LOG_DATE = "date";
+
public static final String JOB_LOG_SCOPE_PARAM = "scope";
public static final String JOB_LOG_TYPE_PARAM = "type";
Modified: incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorEngine.java
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorEngine.java?rev=1185407&r1=1185406&r2=1185407&view=diff
==============================================================================
--- incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorEngine.java (original)
+++ incubator/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorEngine.java Mon Oct 17 22:33:20 2011
@@ -36,6 +36,7 @@ import org.apache.oozie.client.rest.Rest
import org.apache.oozie.command.CommandException;
import org.apache.oozie.command.coord.CoordActionInfoCommand;
import org.apache.oozie.command.coord.CoordActionInfoXCommand;
+import org.apache.oozie.util.CoordActionsInDateRange;
import org.apache.oozie.command.coord.CoordChangeCommand;
import org.apache.oozie.command.coord.CoordChangeXCommand;
import org.apache.oozie.command.coord.CoordJobCommand;
@@ -315,6 +316,7 @@ public class CoordinatorEngine extends B
XLogStreamer.Filter filter = new XLogStreamer.Filter();
filter.setParameter(DagXLogInfoService.JOB, jobId);
if (logRetrievalScope != null && logRetrievalType != null) {
+ // if coordinator action logs are to be retrieved based on action id range
if (logRetrievalType.equals(RestConstants.JOB_LOG_ACTION)) {
Set<String> actions = new HashSet<String>();
String[] list = logRetrievalScope.split(",");
@@ -368,6 +370,21 @@ public class CoordinatorEngine extends B
}
filter.setParameter(DagXLogInfoService.ACTION, commaSeparatedActions.toString());
}
+ // 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);
+ StringBuilder commaSeparatedActions = new StringBuilder("");
+ boolean commaRequired = false;
+ for (CoordinatorActionBean coordAction : actionsList) {
+ if (commaRequired) {
+ commaSeparatedActions.append(",");
+ }
+ commaSeparatedActions.append(coordAction.getId());
+ commaRequired = true;
+ }
+ filter.setParameter(DagXLogInfoService.ACTION, commaSeparatedActions.toString());
+ }
CoordinatorJobBean job = getCoordJobWithNoActionInfo(jobId);
Services.get().get(XLogService.class).streamLog(filter, job.getCreatedTime(), new Date(), writer);
}
Modified: incubator/oozie/trunk/release-log.txt
URL: http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1185407&r1=1185406&r2=1185407&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Mon Oct 17 22:33:20 2011
@@ -1,4 +1,6 @@
-- Oozie 3.1.1 release
+
+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-26 Ability to get the log content from Archived file(.gz format)