You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2014/07/02 17:01:27 UTC
svn commit: r1607387 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd:
IJobDriver.java JobDriver.java JobDriverComponent.java
Author: degenaro
Date: Wed Jul 2 15:01:26 2014
New Revision: 1607387
URL: http://svn.apache.org/r1607387
Log:
UIMA-3921 When a JD fails to start (e.g. classpath error) it marks the job as complete
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/IJobDriver.java
uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriver.java
uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriverComponent.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/IJobDriver.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/IJobDriver.java?rev=1607387&r1=1607386&r2=1607387&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/IJobDriver.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/IJobDriver.java Wed Jul 2 15:01:26 2014
@@ -21,11 +21,12 @@ package org.apache.uima.ducc.jd;
import org.apache.uima.ducc.jd.client.IWorkItemMonitor;
import org.apache.uima.ducc.jd.client.ThreadLocation;
import org.apache.uima.ducc.transport.event.common.IDuccWorkJob;
+import org.apache.uima.ducc.transport.event.jd.DriverStatusReport;
public interface IJobDriver extends IJobDriverAccess, IWorkItemMonitor {
- public void initialize(IDuccWorkJob job, String jdJmxUrl) throws JobDriverTerminateException;
+ public void initialize(IDuccWorkJob job, DriverStatusReport driverStatusReport) throws JobDriverTerminateException;
public void run();
public IDuccWorkJob getJob();
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriver.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriver.java?rev=1607387&r1=1607386&r2=1607387&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriver.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriver.java Wed Jul 2 15:01:26 2014
@@ -93,7 +93,6 @@ public class JobDriver extends Thread im
private DuccId jobid = null;
private IDuccWorkJob job = null;
- private String jdJmxUrl = null;
private DriverStatusReport driverStatusReport = null;
private WorkItemStateKeeper workItemStateKeeper = null;
@@ -132,7 +131,7 @@ public class JobDriver extends Thread im
super();
}
- public void initialize(IDuccWorkJob job, String jdJmxUrl) throws JobDriverTerminateException {
+ public void initialize(IDuccWorkJob job, DriverStatusReport driverStatusReport) throws JobDriverTerminateException {
String location = "initialize";
duccOut.info(location, jobid, "jd.step:"+location);
try {
@@ -143,8 +142,7 @@ public class JobDriver extends Thread im
//
setJobid(job.getDuccId());
setDuccWorkJob(job);
- setJdJmxUrl(jdJmxUrl);
- driverStatusReport = new DriverStatusReport(job.getDuccId(),getJdJmxUrl());
+ setDriverStatusReport(driverStatusReport);
driverStatusReport.setInitializing();
duccOut.debug(location, jobid, "driverState:"+driverStatusReport.getDriverState());
// Handle UIMA deployment descriptor
@@ -239,11 +237,17 @@ public class JobDriver extends Thread im
duccOut.warn(location, jobid, "no work items to process");
}
}
- catch (JobDriverTerminateException e) {
+ catch (Exception e) {
+ duccErr.error(location, jobid, e);
duccOut.error(location, jobid, e);
+ IRationale rationale = new Rationale("Exception occurred");
+ driverStatusReport.setFailed(rationale);
}
catch(Throwable t) {
+ duccErr.error(location, jobid, t);
duccOut.error(location, jobid, t);
+ IRationale rationale = new Rationale("Error occurred");
+ driverStatusReport.setFailed(rationale);
}
duccOut.debug(location, jobid, "thread processing complete");
}
@@ -256,14 +260,10 @@ public class JobDriver extends Thread im
setJob(value);
}
- private void setJdJmxUrl(String value) {
- jdJmxUrl = value;
+ private void setDriverStatusReport(DriverStatusReport value) {
+ driverStatusReport = value;
}
- private String getJdJmxUrl() {
- return jdJmxUrl;
- }
-
private void missingCallbackReaper() {
String location = "missingCallbackReaper";
try {
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriverComponent.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriverComponent.java?rev=1607387&r1=1607386&r2=1607387&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriverComponent.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-jd/src/main/java/org/apache/uima/ducc/jd/JobDriverComponent.java Wed Jul 2 15:01:26 2014
@@ -63,6 +63,7 @@ implements IJobDriverComponent {
private DuccId duccId = null;
private String jobId = String.valueOf(-1);
protected JobDriver thread = null;
+ protected DriverStatusReport driverStatusReport = null;
private String jdBrokerUrl;
private String jdQueue;
@@ -141,7 +142,8 @@ implements IJobDriverComponent {
try {
thread = new JobDriver();
duccOut.trace(methodName, job.getDuccId(), "thread:"+thread);
- thread.initialize(job, getProcessJmxUrl());
+ driverStatusReport = new DriverStatusReport(job.getDuccId(),getProcessJmxUrl());
+ thread.initialize(job, driverStatusReport);
thread.start();
jpc = new JobProcessCollection(job);
}
@@ -204,22 +206,26 @@ implements IJobDriverComponent {
publicationCounter.addAndGet(1);
try {
duccOut.debug(methodName, null, duccMsg.fetch("publishing state"));
- if(thread != null) {
- thread.rectifyStatus();
- DriverStatusReport dsr = thread.getDriverStatusReportCopy();
- if(dsr == null) {
- duccOut.debug(methodName, null, duccMsg.fetch("dsr is null"));
+ try {
+ if(thread != null) {
+ thread.rectifyStatus();
}
else {
- duccOut.debug(methodName, null, "driverState:"+dsr.getDriverState());
- duccOut.debug(methodName, dsr.getDuccId(), dsr.getLogReport());
- jdStateDuccEvent.setState(dsr);
+ duccOut.debug(methodName, null, duccMsg.fetch("thread is null"));
}
- publisher();
+ }
+ catch(Throwable t) {
+ }
+ DriverStatusReport dsr = driverStatusReport;
+ if(dsr == null) {
+ duccOut.debug(methodName, null, duccMsg.fetch("dsr is null"));
}
else {
- duccOut.debug(methodName, null, duccMsg.fetch("thread is null"));
+ duccOut.debug(methodName, null, "driverState:"+dsr.getDriverState());
+ duccOut.debug(methodName, dsr.getDuccId(), dsr.getLogReport());
+ jdStateDuccEvent.setState(dsr);
}
+ publisher();
}
catch(Exception e) {
duccOut.error(methodName, null, e);