Author: virag
Date: Wed Jul 3 17:00:28 2013
New Revision: 1499476
URL: http://svn.apache.org/r1499476
Log:
OOZIE-1441 Fix bugs related to coordchange and parentId in events (mona,virag
via virag)
Modified:
oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/event/SLAEvent.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/DagEngine.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/StartXCommand.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateDeleteJPAExecutor.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryGetJPAExecutor.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/jms/JMSSLAEventListener.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalcStatus.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLAOperations.java
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLACalculationJPAExecutor.java
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLAService.java
oozie/branches/branch-4.0/release-log.txt
oozie/branches/branch-4.0/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js
Modified:
oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/event/SLAEvent.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/event/SLAEvent.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/event/SLAEvent.java
(original)
+++
oozie/branches/branch-4.0/client/src/main/java/org/apache/oozie/client/event/SLAEvent.java
Wed Jul 3 17:00:28 2013
@@ -186,4 +186,11 @@ public abstract class SLAEvent extends E
*/
public abstract String getJobStatus();
+ /**
+ * Get the last modified time
+ *
+ * @return Date last modified time
+ */
+ public abstract Date getLastModifiedTime();
+
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
Wed Jul 3 17:00:28 2013
@@ -109,7 +109,7 @@ import org.apache.openjpa.persistence.jd
// Query to maintain backward compatibility for coord job info command
@NamedQuery(name =
"GET_ALL_COLS_FOR_ACTIONS_FOR_COORD_JOB_ORDER_BY_NOMINAL_TIME", query = "select
OBJECT(a) from CoordinatorActionBean a where a.jobId = :jobId order by
a.nominalTimestamp"),
// Query to retrieve action id, action status, pending status and
external Id of not completed Coordinator actions
- @NamedQuery(name = "GET_COORD_ACTIONS_NOT_COMPLETED", query = "select
a.id, a.status, a.pending, a.externalId, a.pushMissingDependencies,
a.nominalTimestamp, a.createdTimestamp from CoordinatorActionBean a where
a.jobId = :jobId AND a.status <> 'FAILED' AND a.status <> 'TIMEDOUT' AND
a.status <> 'SUCCEEDED' AND a.status <> 'KILLED'"),
+ @NamedQuery(name = "GET_COORD_ACTIONS_NOT_COMPLETED", query = "select
a.id, a.status, a.pending, a.externalId, a.pushMissingDependencies,
a.nominalTimestamp, a.createdTimestamp, a.jobId from CoordinatorActionBean a
where a.jobId = :jobId AND a.status <> 'FAILED' AND a.status <> 'TIMEDOUT' AND
a.status <> 'SUCCEEDED' AND a.status <> 'KILLED'"),
// Query to retrieve action id, action status, pending status and
external Id of running Coordinator actions
@NamedQuery(name = "GET_COORD_ACTIONS_RUNNING", query = "select a.id,
a.status, a.pending, a.externalId, a.nominalTimestamp, a.createdTimestamp from
CoordinatorActionBean a where a.jobId = :jobId and a.status = 'RUNNING'"),
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/DagEngine.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/DagEngine.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/DagEngine.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/DagEngine.java
Wed Jul 3 17:00:28 2013
@@ -127,9 +127,9 @@ public class DagEngine extends BaseEngin
validateSubmitConfiguration(conf);
try {
String jobId;
- SubmitXCommand submit = new SubmitXCommand(conf);
+ SubmitXCommand submit = new SubmitXCommand(conf, parentId);
jobId = submit.call();
- new StartXCommand(jobId, parentId).call();
+ start(jobId);
return jobId;
}
catch (CommandException ex) {
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
Wed Jul 3 17:00:28 2013
@@ -44,9 +44,11 @@ import org.apache.oozie.executor.jpa.Coo
import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.executor.jpa.sla.SLARegistrationGetJPAExecutor;
+import org.apache.oozie.executor.jpa.sla.SLASummaryGetJPAExecutor;
import org.apache.oozie.service.JPAService;
import org.apache.oozie.service.Services;
import org.apache.oozie.sla.SLARegistrationBean;
+import org.apache.oozie.sla.SLASummaryBean;
import org.apache.oozie.sla.service.SLAService;
import org.apache.oozie.util.DateUtils;
import org.apache.oozie.util.JobUtils;
@@ -262,12 +264,18 @@ public class CoordChangeXCommand extends
CoordinatorActionBean bean = jpaService.execute(new
CoordActionGetJPAExecutor(actionId));
// delete SLA registration entry (if any) for action
if (SLAService.isEnabled()) {
- Services.get().get(SLAService.class).removeRegistration(jobId);
+
Services.get().get(SLAService.class).removeRegistration(actionId);
}
- SLARegistrationBean slaReg = jpaService.execute(new
SLARegistrationGetJPAExecutor(jobId));
+ SLARegistrationBean slaReg = jpaService.execute(new
SLARegistrationGetJPAExecutor(actionId));
if (slaReg != null) {
+ LOG.debug("Deleting registration bean corresponding to action
" + slaReg.getId());
deleteList.add(slaReg);
}
+ SLASummaryBean slaSummaryBean = jpaService.execute(new
SLASummaryGetJPAExecutor(actionId));
+ if (slaSummaryBean != null) {
+ LOG.debug("Deleting summary bean corresponding to action " +
slaSummaryBean.getId());
+ deleteList.add(slaSummaryBean);
+ }
deleteList.add(bean);
}
catch (JPAExecutorException e) {
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
Wed Jul 3 17:00:28 2013
@@ -23,7 +23,6 @@ import org.apache.oozie.client.WorkflowJ
import org.apache.oozie.client.SLAEvent.SlaAppType;
import org.apache.oozie.client.SLAEvent.Status;
import org.apache.oozie.client.rest.JsonBean;
-import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.SLAEventBean;
import org.apache.oozie.WorkflowActionBean;
import org.apache.oozie.WorkflowJobBean;
@@ -34,7 +33,6 @@ import org.apache.oozie.command.Precondi
import org.apache.oozie.command.coord.CoordActionUpdateXCommand;
import org.apache.oozie.command.wf.ActionXCommand.ActionExecutorContext;
import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordActionGetForExternalIdJPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor;
import org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor;
@@ -71,8 +69,6 @@ public class SignalXCommand extends Work
private JPAService jpaService = null;
private String jobId;
private String actionId;
- private String parentId;
- private CoordinatorActionBean coordAction;
private WorkflowJobBean wfJob;
private WorkflowActionBean wfAction;
private List<JsonBean> updateList = new ArrayList<JsonBean>();
@@ -82,14 +78,13 @@ public class SignalXCommand extends Work
private String wfJobErrorMsg;
- public SignalXCommand(String name, int priority, String jobId, String
parentId) {
+ public SignalXCommand(String name, int priority, String jobId) {
super(name, name, priority);
this.jobId = ParamChecker.notEmpty(jobId, "jobId");
- this.parentId = parentId;
}
public SignalXCommand(String jobId, String actionId) {
- this("signal", 1, jobId, null);
+ this("signal", 1, jobId);
this.actionId = ParamChecker.notEmpty(actionId, "actionId");
}
@@ -112,8 +107,6 @@ public class SignalXCommand extends Work
LogUtils.setLogInfo(wfJob, logInfo);
if (actionId != null) {
this.wfAction = jpaService.execute(new
WorkflowActionGetJPAExecutor(actionId));
- coordAction = jpaService.execute(new
CoordActionGetForExternalIdJPAExecutor(wfJob
- .getId()));
LogUtils.setLogInfo(wfAction, logInfo);
}
}
@@ -331,13 +324,6 @@ public class SignalXCommand extends Work
// call JPAExecutor to do the bulk writes
jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList,
insertList));
if (generateEvent && EventHandlerService.isEnabled()) {
- if (coordAction != null) {
- wfJob.setParentId(coordAction.getId());
- }
- else if (wfJob.getParentId() == null) {
- wfJob.setParentId(parentId);
- }
- // doesn't overwrite parentId in subworkflow action
generateEvent(wfJob, wfJobErrorCode, wfJobErrorMsg);
}
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/StartXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/StartXCommand.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/StartXCommand.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/StartXCommand.java
Wed Jul 3 17:00:28 2013
@@ -25,11 +25,7 @@ import org.apache.oozie.util.InstrumentU
public class StartXCommand extends SignalXCommand {
public StartXCommand(String id) {
- this(id, null);
- }
-
- public StartXCommand(String jobId, String parentId) {
- super("start", 1, jobId, parentId);
+ super("start", 1, id);
InstrumentUtils.incrJobCounter(getName(), 1, getInstrumentation());
}
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
Wed Jul 3 17:00:28 2013
@@ -75,12 +75,12 @@ public class SubmitXCommand extends Work
private Configuration conf;
private List<JsonBean> insertList = new ArrayList<JsonBean>();
+ private String parentId;
/**
* Constructor to create the workflow Submit Command.
*
* @param conf : Configuration for workflow job
- * @param authToken : To be used for authentication
*/
public SubmitXCommand(Configuration conf) {
super("submit", "submit", 1);
@@ -88,6 +88,17 @@ public class SubmitXCommand extends Work
}
/**
+ * Constructor for submitting wf through coordinator
+ *
+ * @param conf : Configuration for workflow job
+ * @param parentId: the coord action id
+ */
+ public SubmitXCommand(Configuration conf, String parentId) {
+ this(conf);
+ this.parentId = parentId;
+ }
+
+ /**
* Constructor to create the workflow Submit Command.
*
* @param dryrun : if dryrun
@@ -192,6 +203,10 @@ public class SubmitXCommand extends Work
if (workflow.getParentId() == null) {
workflow.setParentId(conf.get(SubWorkflowActionExecutor.PARENT_ID));
}
+ // Set to coord action Id if workflow submitted through coordinator
+ if (workflow.getParentId() == null) {
+ workflow.setParentId(parentId);
+ }
LogUtils.setLogInfo(workflow, logInfo);
LOG = XLog.resetPrefix(LOG);
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateDeleteJPAExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateDeleteJPAExecutor.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateDeleteJPAExecutor.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateDeleteJPAExecutor.java
Wed Jul 3 17:00:28 2013
@@ -25,6 +25,7 @@ import org.apache.oozie.CoordinatorActio
import org.apache.oozie.ErrorCode;
import org.apache.oozie.FaultInjection;
import org.apache.oozie.client.rest.JsonBean;
+import org.apache.oozie.sla.SLARegistrationBean;
import org.apache.oozie.util.ParamChecker;
/**
@@ -111,7 +112,7 @@ public class BulkUpdateDeleteJPAExecutor
if (forRerun) {
em.remove(em.merge(entity));
}
- else {
+ else if (entity instanceof CoordinatorActionBean) {
Query g =
em.createNamedQuery("DELETE_UNSCHEDULED_ACTION");
String coordActionId = ((CoordinatorActionBean)
entity).getId();
g.setParameter("id", coordActionId);
@@ -119,6 +120,9 @@ public class BulkUpdateDeleteJPAExecutor
if (actionsDeleted == 0)
throw new JPAExecutorException(ErrorCode.E1022,
coordActionId);
}
+ else {
+ em.remove(em.merge(entity));
+ }
}
}
return null;
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobGetActionsNotCompletedJPAExecutor.java
Wed Jul 3 17:00:28 2013
@@ -101,6 +101,9 @@ public class CoordJobGetActionsNotComple
if (arr[6] != null){
bean.setCreatedTime(DateUtils.toDate((Timestamp) arr[6]));
}
+ if (arr[7] != null) {
+ bean.setJobId((String) arr[7]);
+ }
return bean;
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryGetJPAExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryGetJPAExecutor.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryGetJPAExecutor.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryGetJPAExecutor.java
Wed Jul 3 17:00:28 2013
@@ -17,6 +17,8 @@
*/
package org.apache.oozie.executor.jpa.sla;
+import java.util.List;
+
import javax.persistence.EntityManager;
import javax.persistence.Query;
@@ -41,19 +43,24 @@ public class SLASummaryGetJPAExecutor im
return "SLASummaryGetJPAExecutor";
}
+ @SuppressWarnings("unchecked")
@Override
public SLASummaryBean execute(EntityManager em) throws
JPAExecutorException {
- SLASummaryBean ssBean;
+ List<SLASummaryBean> ssBeans;
Query q;
try {
q = em.createNamedQuery("GET_SLA_SUMMARY");
q.setParameter("id", id);
- ssBean = (SLASummaryBean) q.getSingleResult();
+ ssBeans = q.getResultList();
}
catch (Exception e) {
throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
}
- return ssBean;
+ SLASummaryBean slaSummaryBean = null;
+ if (ssBeans != null && ssBeans.size() > 0) {
+ slaSummaryBean = ssBeans.get(0);
+ }
+ return slaSummaryBean;
}
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/jms/JMSSLAEventListener.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/jms/JMSSLAEventListener.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/jms/JMSSLAEventListener.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/jms/JMSSLAEventListener.java
Wed Jul 3 17:00:28 2013
@@ -109,6 +109,7 @@ public class JMSSLAEventListener extends
textMessage.setStringProperty(JMSHeaderConstants.APP_NAME,
slaMsg.getAppName());
textMessage.setStringProperty(JMSHeaderConstants.USER,
slaMsg.getUser());
textMessage.setStringProperty(JMSHeaderConstants.MESSAGE_FORMAT, messageFormat);
+ LOG.trace("Event related JMS text body [{0}]",
textMessage.getText());
LOG.trace("Event related JMS message [{0}]",
textMessage.toString());
MessageProducer producer = jmsContext.createProducer(session,
topicName);
producer.setDeliveryMode(jmsDeliveryMode);
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalcStatus.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalcStatus.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalcStatus.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalcStatus.java
Wed Jul 3 17:00:28 2013
@@ -164,10 +164,6 @@ public class SLACalcStatus extends SLAEv
this.eventStatus = es;
}
- public Date getLastModifiedTime() {
- return lastModifiedTime;
- }
-
public void setLastModifiedTime(Date lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
}
@@ -265,8 +261,13 @@ public class SLACalcStatus extends SLAEv
}
@Override
+ public Date getLastModifiedTime() {
+ return lastModifiedTime;
+ }
+
+ @Override
public String toString() {
- return "ID: " + getId() + " SLAStatus: " + slaStatus + " EventStatus:
"+eventStatus + "AppType " + getAppType();
+ return "ID: " + getId() + " SLAStatus: " + slaStatus + " EventStatus:
"+eventStatus + " AppType " + getAppType();
}
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
Wed Jul 3 17:00:28 2013
@@ -32,6 +32,7 @@ import java.util.concurrent.ConcurrentHa
import org.apache.hadoop.conf.Configuration;
import org.apache.oozie.AppType;
import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
import org.apache.oozie.WorkflowActionBean;
import org.apache.oozie.WorkflowJobBean;
import org.apache.oozie.client.CoordinatorAction;
@@ -494,6 +495,9 @@ public class SLACalculatorMemory impleme
}
else if (historySet.contains(jobId)) {
slaInfo = jpaService.execute(new SLASummaryGetJPAExecutor(jobId));
+ if (slaInfo == null) {
+ throw new JPAExecutorException(ErrorCode.E0604, jobId);
+ }
slaInfo.setJobStatus(jobStatus);
slaInfo.setActualStart(startTime);
slaInfo.setActualEnd(endTime);
@@ -712,6 +716,9 @@ public class SLACalculatorMemory impleme
slaCalc.setActualEnd(wf.getEndTime());
slaCalc.setActualStart(wf.getStartTime());
}
+ else {
+ isMiss = true;
+ }
slaCalc.setJobStatus(ca.getStatusStr());
break;
default:
@@ -733,11 +740,10 @@ public class SLACalculatorMemory impleme
}
catch (Exception e) {
XLog.getLog(SLAService.class).warn(
- "Error while confirming End_miss against DB: " + e
- + ". Setting END_MISS since time limit has been
exceeded");
+ "Error while confirming End_miss against DB: "
+ + ". Setting END_MISS since time limit has been
exceeded", e);
slaCalc.setEventStatus(EventStatus.END_MISS);
slaCalc.setSLAStatus(SLAStatus.MISS);
- slaCalc.setEventProcessed(8);
}
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLAOperations.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLAOperations.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLAOperations.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLAOperations.java
Wed Jul 3 17:00:28 2013
@@ -151,7 +151,7 @@ public class SLAOperations {
throw new CommandException(ErrorCode.E1007, " id " + jobId,
e.getMessage(), e);
}
- log.debug("Job [{0}] reg for SLA. Size of Sla Xml = [{1}]", jobId,
XmlUtils.prettyPrint(eSla).toString());
+ log.debug("Job [{0}] reg for SLA. Size of Sla Xml = [{1}]", jobId,
XmlUtils.prettyPrint(eSla).toString().length());
return sla;
}
Modified:
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
(original)
+++
oozie/branches/branch-4.0/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
Wed Jul 3 17:00:28 2013
@@ -252,12 +252,14 @@ public class SLARegistrationBean impleme
}
private void slaConfigStringToMap() {
- StringTokenizer st = new StringTokenizer(slaConfig, "},");
- while (st.hasMoreTokens()) {
- String token = st.nextToken();
- String[] pair = token.split("=");
- if (pair.length == 2) {
- slaConfigMap.put(pair[0].substring(1), pair[1]);
+ if (slaConfig != null) {
+ StringTokenizer st = new StringTokenizer(slaConfig, "},");
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ String[] pair = token.split("=");
+ if (pair.length == 2) {
+ slaConfigMap.put(pair[0].substring(1), pair[1]);
+ }
}
}
}
Modified:
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
(original)
+++
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
Wed Jul 3 17:00:28 2013
@@ -17,23 +17,32 @@
*/
package org.apache.oozie.command.coord;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
+import org.apache.oozie.CoordinatorActionBean;
import org.apache.oozie.CoordinatorJobBean;
import org.apache.oozie.ErrorCode;
import org.apache.oozie.client.CoordinatorAction;
import org.apache.oozie.client.CoordinatorJob;
import org.apache.oozie.client.CoordinatorJob.Execution;
import org.apache.oozie.client.CoordinatorJob.Timeunit;
+import org.apache.oozie.client.rest.JsonBean;
import org.apache.oozie.client.Job;
import org.apache.oozie.command.CommandException;
import
org.apache.oozie.executor.jpa.CoordJobGetActionByActionNumberJPAExecutor;
import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.sla.SLACalculationInsertUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.sla.SLARegistrationGetJPAExecutor;
+import org.apache.oozie.executor.jpa.sla.SLASummaryGetJPAExecutor;
import org.apache.oozie.service.JPAService;
import org.apache.oozie.service.Services;
import org.apache.oozie.service.StatusTransitService;
+import org.apache.oozie.sla.SLARegistrationBean;
+import org.apache.oozie.sla.SLASummaryBean;
import org.apache.oozie.store.StoreException;
import org.apache.oozie.test.XDataTestCase;
import org.apache.oozie.util.DateUtils;
@@ -311,13 +320,40 @@ public class TestCoordChangeXCommand ext
String pauseTimeChangeStr = "pausetime=" +
DateUtils.formatDateOozieTZ(pauseTime);
final CoordinatorJobBean job =
addRecordToCoordJobTableForPauseTimeTest(CoordinatorJob.Status.RUNNING, start,
end, end, true, false, 4);
- addRecordToCoordActionTable(job.getId(), 1,
CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
- addRecordToCoordActionTable(job.getId(), 2,
CoordinatorAction.Status.SUCCEEDED, "coord-action-get.xml", 0);
- addRecordToCoordActionTable(job.getId(), 3,
CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);
- addRecordToCoordActionTable(job.getId(), 4,
CoordinatorAction.Status.WAITING, "coord-action-get.xml", 0);
+ CoordinatorActionBean ca1 = addRecordToCoordActionTable(job.getId(),
1, CoordinatorAction.Status.SUCCEEDED,
+ "coord-action-get.xml", 0);
+ CoordinatorActionBean ca2 = addRecordToCoordActionTable(job.getId(),
2, CoordinatorAction.Status.SUCCEEDED,
+ "coord-action-get.xml", 0);
+ CoordinatorActionBean ca3 = addRecordToCoordActionTable(job.getId(),
3, CoordinatorAction.Status.WAITING,
+ "coord-action-get.xml", 0);
+ CoordinatorActionBean ca4 = addRecordToCoordActionTable(job.getId(),
4, CoordinatorAction.Status.WAITING,
+ "coord-action-get.xml", 0);
+
+ SLARegistrationBean slaRegBean1 = new SLARegistrationBean();
+ slaRegBean1.setId(ca1.getId());
+ SLARegistrationBean slaRegBean2 = new SLARegistrationBean();
+ slaRegBean2.setId(ca2.getId());
+ SLARegistrationBean slaRegBean3 = new SLARegistrationBean();
+ slaRegBean3.setId(ca3.getId());
+ SLARegistrationBean slaRegBean4 = new SLARegistrationBean();
+ slaRegBean4.setId(ca4.getId());
+ SLASummaryBean slaSummaryBean1 = new SLASummaryBean();
+ slaSummaryBean1.setId(ca1.getId());
+ SLASummaryBean slaSummaryBean3 = new SLASummaryBean();
+ slaSummaryBean3.setId(ca3.getId());
+ List<JsonBean> insertList = new ArrayList<JsonBean>();
+ insertList.add(slaRegBean1);
+ insertList.add(slaRegBean2);
+ insertList.add(slaRegBean3);
+ insertList.add(slaRegBean4);
+ insertList.add(slaSummaryBean1);
+ insertList.add(slaSummaryBean3);
- new CoordChangeXCommand(job.getId(), pauseTimeChangeStr).call();
JPAService jpaService = Services.get().get(JPAService.class);
+ jpaService.execute(new
SLACalculationInsertUpdateJPAExecutor(insertList, null));
+
+ new CoordChangeXCommand(job.getId(), pauseTimeChangeStr).call();
+
CoordJobGetJPAExecutor coordGetCmd = new
CoordJobGetJPAExecutor(job.getId());
CoordinatorJobBean coordJob = jpaService.execute(coordGetCmd);
assertEquals(DateUtils.formatDateOozieTZ(coordJob.getPauseTime()),
DateUtils.formatDateOozieTZ(pauseTime));
@@ -341,6 +377,18 @@ public class TestCoordChangeXCommand ext
jpae.printStackTrace();
}
+ slaRegBean1 = jpaService.execute(new
SLARegistrationGetJPAExecutor(slaRegBean1.getId()));
+ assertNotNull(slaRegBean1);
+ slaRegBean2 = jpaService.execute(new
SLARegistrationGetJPAExecutor(slaRegBean2.getId()));
+ assertNotNull(slaRegBean2);
+ slaRegBean3 = jpaService.execute(new
SLARegistrationGetJPAExecutor(slaRegBean3.getId()));
+ assertNull(slaRegBean3);
+ slaRegBean4 = jpaService.execute(new
SLARegistrationGetJPAExecutor(slaRegBean4.getId()));
+ assertNull(slaRegBean4);
+ slaSummaryBean3 = jpaService.execute(new
SLASummaryGetJPAExecutor(slaSummaryBean3.getId()));
+ assertNull(slaSummaryBean3);
+ slaSummaryBean1 = jpaService.execute(new
SLASummaryGetJPAExecutor(slaSummaryBean1.getId()));
+ assertNotNull(slaSummaryBean1);
}
//Checks that RUNNING coord action is not deleted
Modified:
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
(original)
+++
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobGetActionsNotCompletedJPAExecutor.java
Wed Jul 3 17:00:28 2013
@@ -89,6 +89,7 @@ public class TestCoordJobGetActionsNotCo
assertEquals(action.getId(), actionId);
assertEquals(action.getStatus(), status);
assertEquals(action.getPending(), pending);
+ assertEquals(jobId, action.getJobId());
}
// test sql selection operator
Modified:
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLACalculationJPAExecutor.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLACalculationJPAExecutor.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLACalculationJPAExecutor.java
(original)
+++
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLACalculationJPAExecutor.java
Wed Jul 3 17:00:28 2013
@@ -22,12 +22,10 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
-import org.apache.oozie.ErrorCode;
import org.apache.oozie.FaultInjection;
import org.apache.oozie.client.event.SLAEvent.EventStatus;
import org.apache.oozie.client.rest.JsonBean;
import org.apache.oozie.command.SkipCommitFaultInjection;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
import org.apache.oozie.executor.jpa.sla.SLACalculationInsertUpdateJPAExecutor;
import org.apache.oozie.executor.jpa.sla.SLASummaryGetJPAExecutor;
import org.apache.oozie.service.JPAService;
@@ -209,13 +207,9 @@ public class TestSLACalculationJPAExecut
assertNull(sBean.getActualEnd());
SLASummaryGetJPAExecutor readCmd1 = new
SLASummaryGetJPAExecutor(wfId2);
- try {
- sBean = jpaService.execute(readCmd1);
- fail("Expected not found exception but didnt get any");
- }
- catch (JPAExecutorException jpaee) {
- assertEquals(ErrorCode.E0603, jpaee.getErrorCode());
- }
+ sBean = jpaService.execute(readCmd1);
+ assertNull(sBean); //new bean should not have been inserted due to
rollback
+
}
private SLASummaryBean _createSLASummaryBean(String jobId, String status,
EventStatus slaType, Date eStart,
Modified:
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLAService.java
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLAService.java?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLAService.java
(original)
+++
oozie/branches/branch-4.0/core/src/test/java/org/apache/oozie/sla/TestSLAService.java
Wed Jul 3 17:00:28 2013
@@ -265,17 +265,6 @@ public class TestSLAService extends XDat
assertEquals(8, slaSummary.getEventProcessed());
assertNull(slas.getSLACalculator().get(action1.getId())); //removed
from memory
- //testing rogue (Does not exist in DB) job miss and sla map update
- sla = _createSLARegistration("rogue", AppType.WORKFLOW_ACTION);
- sla.setExpectedEnd(new Date(System.currentTimeMillis() - 1 * 1800 *
1000));
- slas.addRegistrationEvent(sla);
- int prevSize = slas.getSLACalculator().size();
- slas.runSLAWorker();
- ehs.new EventWorker().run();
- assertTrue(output.toString().contains("rogue Sla END - MISS!!!"));
- assertEquals(prevSize - 1, slas.getSLACalculator().size());
- assertNull(slas.getSLACalculator().get(sla.getId())); //not lying
around in history set either
-
}
static SLARegistrationBean _createSLARegistration(String jobId, AppType
appType) {
Modified: oozie/branches/branch-4.0/release-log.txt
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/release-log.txt?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
--- oozie/branches/branch-4.0/release-log.txt (original)
+++ oozie/branches/branch-4.0/release-log.txt Wed Jul 3 17:00:28 2013
@@ -1,5 +1,6 @@
-- Oozie 4.0.0 release
+OOZIE-1441 Fix bugs related to coordchange and parentId in events (mona,virag
via virag)
OOZIE-1444 Job DAG causes OOM. Remove refresh option (rohini)
OOZIE-1379 Generate SLA end_miss event only after confirming against
persistent store (mona)
OOZIE-1439 Job materialization happening even after coordinator is supposed to
be killed (virag)
Modified:
oozie/branches/branch-4.0/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js
URL:
http://svn.apache.org/viewvc/oozie/branches/branch-4.0/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js?rev=1499476&r1=1499475&r2=1499476&view=diff
==============================================================================
---
oozie/branches/branch-4.0/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js
(original)
+++
oozie/branches/branch-4.0/webapp/src/main/webapp/console/sla/js/oozie-sla-table.js
Wed Jul 3 17:00:28 2013
@@ -207,5 +207,4 @@ function drawTable(jsonData) {
"aaSorting" : [ [ 3, 'desc' ] ],
"bDestroy" : true
});
- oTable.fnSetFilteringDelay(200);
}