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 2015/02/23 21:29:47 UTC
svn commit: r1661765 - in /uima/sandbox/uima-ducc/trunk/uima-ducc-user/src:
main/java/org/apache/uima/ducc/ main/java/org/apache/uima/ducc/user/
main/java/org/apache/uima/ducc/user/jd/iface/
main/resources/org/apache/uima/ducc/ main/resources/org/apach...
Author: degenaro
Date: Mon Feb 23 20:29:46 2015
New Revision: 1661765
URL: http://svn.apache.org/r1661765
Log:
UIMA-4068 DUCC Job Driver (JD) user classpath
package org.apache.uima.ducc to comprise FlowController and ErrorHandler+Directive
Added:
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml (with props)
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestErrorHandler.java
- copied, changed from r1661659, uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java
Removed:
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/DuccJobProcessFC.java
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/user/jd/iface/
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/user/
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java Mon Feb 23 20:29:46 2015
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.uima.ducc.user.common.QuotedOptions;
+import org.apache.uima.ducc.user.error.iface.Transformer;
+import org.apache.uima.ducc.user.jd.JdUser;
+
+public class ErrorHandler implements IErrorHandler {
+
+ public enum InitializationDataKey {
+ KillJobLimit("max_job_errors"),
+ ;
+
+ private String altname = null;
+
+ private InitializationDataKey() {
+ altname = name();
+ }
+
+ private InitializationDataKey(String value) {
+ altname = value;
+ }
+
+ public String altname() {
+ return altname;
+ }
+
+ };
+
+ private static int DefaultJobErrorLimit = JdUser.DefaultJobErrorLimit;
+
+ private AtomicInteger jobErrorLimit = new AtomicInteger(DefaultJobErrorLimit);
+
+ private AtomicInteger jobErrorCount = new AtomicInteger(0);
+
+ public ErrorHandler() {
+ }
+
+ public ErrorHandler(String initializationData) {
+ initialize(initializationData);
+ }
+
+ private Map<String, String> parse(String initializationData) {
+ Map<String, String> map = new HashMap<String, String>();
+ try {
+ if(initializationData != null) {
+ ArrayList<String> toks = QuotedOptions.tokenizeList(initializationData, true);
+ if(toks != null) {
+ for(String tok : toks) {
+ String[] split = tok.split("=");
+ String key = split[0].trim().toLowerCase();
+ String value = split[1].trim();
+ map.put(key, value);
+ }
+ }
+ }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ return map;
+ }
+
+ @Override
+ public void initialize(String initializationData) {
+ if(initializationData != null) {
+ Map<String, String> map = parse(initializationData);
+ String key;
+ key = InitializationDataKey.KillJobLimit.name().toLowerCase();
+ if(map.containsKey(key)) {
+ String value = map.get(key);
+ initKillJob(value);
+ }
+ else {
+ String altkey = InitializationDataKey.KillJobLimit.altname();
+ if(map.containsKey(altkey)) {
+ String value = map.get(altkey);
+ initKillJob(value);
+ }
+ }
+ }
+ }
+
+ private void initKillJob(String value) {
+ try {
+ int expect = DefaultJobErrorLimit;
+ int update = Integer.parseInt(value);
+ jobErrorLimit.compareAndSet(expect, update);
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public IErrorHandlerDirective handle(String serializedCAS, Object byteArray) {
+ ErrorHandlerDirective jdUserDirective = new ErrorHandlerDirective();
+ try {
+ Throwable userThrowable = null;
+ if(serializedCAS != null) {
+ // CAS is provided
+ }
+ if(byteArray != null) {
+ userThrowable = Transformer.deserialize(byteArray);
+ userThrowable.getClass();
+ // Exception is provided
+ }
+ jobErrorCount.incrementAndGet();
+ if(jobErrorCount.get() > jobErrorLimit.get()) {
+ jdUserDirective.setKillJob();
+ }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ }
+ return jdUserDirective;
+ }
+
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java Mon Feb 23 20:29:46 2015
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc;
+
+public class ErrorHandlerDirective implements IErrorHandlerDirective {
+
+ private boolean killJob = false;
+ private boolean killProcess = false;
+ private boolean killWorkItem = true;
+
+ public ErrorHandlerDirective() {
+ }
+
+ public ErrorHandlerDirective(boolean killJob, boolean killProcess, boolean killWorkItem) {
+ setKillJob(killJob);
+ setKillProcess(killProcess);
+ setKillWorkItem(killWorkItem);
+ }
+
+ @Override
+ public boolean isKillJob() {
+ return killJob;
+ }
+
+ private void setKillJob(boolean value) {
+ killJob = value;
+ }
+
+ public void setKillJob() {
+ setKillJob(true);
+ }
+
+ public void resetKillJob() {
+ setKillJob(false);
+ }
+
+ @Override
+ public boolean isKillProcess() {
+ return killProcess;
+ }
+
+ private void setKillProcess(boolean value) {
+ killProcess = value;
+ }
+
+ public void setKillProcess() {
+ setKillProcess(true);
+ }
+
+ public void resetKillProcess() {
+ setKillProcess(false);
+ }
+
+ @Override
+ public boolean isKillWorkItem() {
+ return killWorkItem;
+ }
+
+ private void setKillWorkItem(boolean value) {
+ killWorkItem = value;
+ }
+
+ public void setKillWorkItem() {
+ setKillWorkItem(true);
+ }
+
+ public void resetKillWorkItem() {
+ setKillWorkItem(false);
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/ErrorHandlerDirective.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java Mon Feb 23 20:29:46 2015
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData;
+import org.apache.uima.analysis_engine.metadata.FixedFlow;
+import org.apache.uima.analysis_engine.metadata.FlowConstraints;
+import org.apache.uima.ducc.Workitem;
+import org.apache.uima.flow.FinalStep;
+import org.apache.uima.flow.Flow;
+import org.apache.uima.flow.FlowControllerContext;
+import org.apache.uima.flow.JCasFlowController_ImplBase;
+import org.apache.uima.flow.JCasFlow_ImplBase;
+import org.apache.uima.flow.SimpleStep;
+import org.apache.uima.flow.Step;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.apache.uima.resource.metadata.OperationalProperties;
+
+/**
+ * Ducc FlowController for Job Processes assembled from user components
+ * If CM delegate exists then WI-Cas is first sent there
+ * and then optionally to CC delegate if so specified by flag in WorkItem feature structure.
+ * If no CM delegate, then WI-Cas is sent to AE and CC if it exists.
+ */
+public class FlowController extends JCasFlowController_ImplBase {
+
+ private List<String> mSequence;
+ private boolean mStartsWithCasMultiplier=false;
+
+ public void initialize(FlowControllerContext aContext) throws ResourceInitializationException {
+ super.initialize(aContext);
+
+ FlowConstraints flowConstraints = aContext.getAggregateMetadata().getFlowConstraints();
+ mSequence = new ArrayList<String>();
+ if (flowConstraints instanceof FixedFlow) {
+ String[] sequence = ((FixedFlow) flowConstraints).getFixedFlow();
+ mSequence.addAll(Arrays.asList(sequence));
+ } else {
+ throw new ResourceInitializationException(ResourceInitializationException.FLOW_CONTROLLER_REQUIRES_FLOW_CONSTRAINTS,
+ new Object[]{this.getClass().getName(), "fixedFlow", aContext.getAggregateMetadata().getSourceUrlString()});
+ }
+
+ // Check if first delegate is a CasMultiplier.
+ // Any other CMs will have no special treatment,
+ // i.e. parent will follow children thru the rest of the pipeline
+
+ Iterator<Entry<String, AnalysisEngineMetaData>> aeIter = getContext().getAnalysisEngineMetaDataMap().entrySet().iterator();
+ while (aeIter.hasNext()) {
+ Entry<String, AnalysisEngineMetaData> entry = aeIter.next();
+ AnalysisEngineMetaData md = entry.getValue();
+ OperationalProperties op = md.getOperationalProperties();
+ if (op.getOutputsNewCASes()) {
+ if (mSequence.get(0).equals(entry.getKey())) {
+ mStartsWithCasMultiplier = true;
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.flow.JCasFlowController_ImplBase#computeFlow(org.apache.uima.cas.JCas)
+ */
+ public Flow computeFlow(JCas aCAS) throws AnalysisEngineProcessException {
+ return new FixedFlowObject(0);
+ }
+
+ class FixedFlowObject extends JCasFlow_ImplBase {
+ private int currentStep;
+ private boolean internallyCreatedCas = false;
+
+ /**
+ * Create a new fixed flow starting at step <code>startStep</code> of the fixed sequence.
+ *
+ * @param startStep
+ * index of mSequence to start at
+ */
+ private FixedFlowObject(int startStep) {
+ this(startStep, false);
+ }
+
+ /**
+ * Create a new fixed flow starting at step <code>startStep</code> of the fixed sequence.
+ *
+ * @param startStep
+ * index of mSequence to start at
+ * @param internallyCreatedCas
+ * true to indicate that this Flow object is for a CAS that was produced by a
+ * CasMultiplier within this aggregate.
+ *
+ */
+ private FixedFlowObject(int startStep, boolean internallyCreatedCas) {
+ currentStep = startStep;
+ this.internallyCreatedCas = internallyCreatedCas;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.flow.Flow#next()
+ */
+ @Override
+ public Step next() throws AnalysisEngineProcessException {
+
+ // If this is a work item CAS in a pipeline with an initial CM that has just been
+ // to the CM then check if it should be sent to the last step, e.g. the CC.
+ if (mStartsWithCasMultiplier && !internallyCreatedCas && currentStep == 1) {
+ // Parent CAS has been to the initial CM, so see if a special flow has been requested.
+ // Get an iterator only if the Workitem type is in the CAS's typesystem
+ // (avoids JCAS_TYPE_NOT_IN_CAS error)
+ Iterator<TOP> fsIter = null;
+ if (this.getJCas().getTypeSystem().getType(Workitem.class.getName()) != null) {
+ fsIter = this.getJCas().getJFSIndexRepository().getAllIndexedFS(Workitem.type);
+ }
+ if (fsIter != null && fsIter.hasNext()) {
+ Workitem wi = (Workitem) fsIter.next();
+ if (fsIter.hasNext()) {
+ throw new IllegalStateException("More than one instance of Workitem type");
+ }
+ if (wi.getSendToAll()) {
+ // send WI-CAS to all delegates
+ }
+ else if (wi.getSendToLast()) {
+ // send to last delegate only
+ currentStep = mSequence.size() - 1;
+ }
+ }
+ // No Workitem FS in CAS, WI-CAS is at end of flow
+ else return new FinalStep();
+ }
+
+ if (currentStep >= mSequence.size()) {
+ return new FinalStep(); // this CAS is cooked
+ }
+
+ // Send to next component in pipeline
+ return new SimpleStep((String)mSequence.get(currentStep++));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.uima.flow.JCasFlow_ImplBase#newCasProduced(JCas, String)
+ */
+ @Override
+ public Flow newCasProduced(JCas newCas, String producedBy) throws AnalysisEngineProcessException {
+ // start the new output CAS from the next node after the CasMultiplier that produced it
+ // (there may be a CM in other than the first step)
+ int i = 0;
+ while (!mSequence.get(i).equals(producedBy))
+ i++;
+ return new FixedFlowObject(i + 1, true);
+ }
+ }
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/FlowController.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java Mon Feb 23 20:29:46 2015
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc;
+
+public interface IErrorHandler {
+ public void initialize(String initializationData);
+ public IErrorHandlerDirective handle(String serializedCAS, Object userException);
+}
\ No newline at end of file
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java Mon Feb 23 20:29:46 2015
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc;
+
+public interface IErrorHandlerDirective {
+ public boolean isKillJob();
+ public boolean isKillProcess();
+ public boolean isKillWorkItem();
+}
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/java/org/apache/uima/ducc/IErrorHandlerDirective.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml Mon Feb 23 20:29:46 2015
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<flowControllerDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <implementationName>org.apache.uima.ducc.FlowController</implementationName>
+ <processingResourceMetaData>
+ <name>DUCC Job Flow Controller</name>
+ <description>Ducc FlowController for Job Processes assembled from user components. If WI-Cas is sent to initial CM, it is then dropped. All other parent CASes continue thru the flow.</description>
+ <version>1.0</version>
+ <vendor>Apache UIMA</vendor>
+ <configurationParameters/>
+ <configurationParameterSettings/>
+ <typeSystemDescription>
+ <imports>
+ <import location="FlowControllerTS.xml"/>
+ </imports>
+ </typeSystemDescription>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs/>
+ </capability>
+ </capabilities>
+ </processingResourceMetaData>
+</flowControllerDescription>
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowController.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml?rev=1661765&view=auto
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml (added)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml Mon Feb 23 20:29:46 2015
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?><typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
+
+ <!--
+ ***************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ***************************************************************
+ -->
+
+ <name>Ducc Job Text Processing Control Types [String]</name>
+ <description>Type for communication between CR and Job components CM, AE and CC</description>
+ <version>1.0</version>
+ <vendor>Apache UIMA</vendor>
+ <types>
+ <typeDescription>
+ <name>org.apache.uima.ducc.Workitem</name>
+ <description/>
+ <supertypeName>uima.cas.TOP</supertypeName>
+ <features>
+ <featureDescription>
+ <name>sendToLast</name>
+ <description/>
+ <rangeTypeName>uima.cas.Boolean</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>sendToAll</name>
+ <description/>
+ <rangeTypeName>uima.cas.Boolean</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>inputspec</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>outputspec</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>encoding</name>
+ <description>Optional parameter to use when converting input files into Java characters</description>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>language</name>
+ <description>Optional parameter to specify the text language</description>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>bytelength</name>
+ <description>Length in bytes of work item</description>
+ <rangeTypeName>uima.cas.Integer</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>blockindex</name>
+ <description>Optional parameter to specify block sequence number for input file</description>
+ <rangeTypeName>uima.cas.Integer</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>blocksize</name>
+ <description>Optional parameter to specify block size</description>
+ <rangeTypeName>uima.cas.Integer</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>lastBlock</name>
+ <description>Optional parameter to specify this is last chunk for work item</description>
+ <rangeTypeName>uima.cas.Boolean</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ </types>
+</typeSystemDescription>
\ No newline at end of file
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/main/resources/org/apache/uima/ducc/FlowControllerTS.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java?rev=1661765&r1=1661764&r2=1661765&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/TestSuite.java Mon Feb 23 20:29:46 2015
@@ -28,6 +28,10 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import org.apache.uima.ducc.ErrorHandler;
+import org.apache.uima.ducc.ErrorHandler.InitializationDataKey;
+import org.apache.uima.ducc.IErrorHandler;
+import org.apache.uima.ducc.IErrorHandlerDirective;
import org.apache.uima.ducc.user.common.ExceptionHelper;
import org.apache.uima.ducc.user.dgen.DeployableGenerator;
import org.apache.uima.ducc.user.dgen.DuccUimaAggregate;
@@ -37,11 +41,7 @@ import org.apache.uima.ducc.user.dgen.ID
import org.apache.uima.ducc.user.dgen.iface.DeployableGeneration;
import org.apache.uima.ducc.user.jd.JdUserCollectionReader;
import org.apache.uima.ducc.user.jd.JdUserMetaCas;
-import org.apache.uima.ducc.user.jd.iface.IJdUserDirective;
-import org.apache.uima.ducc.user.jd.iface.IJdUserErrorHandler;
-import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler;
-import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler.InitializationDataKey;
-import org.apache.uima.ducc.user.jd.test.helper.TestJdUserErrorHandler;
+import org.apache.uima.ducc.user.jd.test.helper.TestErrorHandler;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -205,9 +205,9 @@ public class TestSuite {
@Test
public void test06() {
try {
- IJdUserErrorHandler eh = new JdUserErrorHandler();
+ IErrorHandler eh = new ErrorHandler();
String serializedCAS = null;
- IJdUserDirective directive = eh.handle(serializedCAS, getUserException());
+ IErrorHandlerDirective directive = eh.handle(serializedCAS, getUserException());
assertTrue(directive.isKillJob() == false);
assertTrue(directive.isKillProcess() == false);
assertTrue(directive.isKillWorkItem() == true);
@@ -235,25 +235,25 @@ public class TestSuite {
String serializedCAS = jdUserMetaCas.getSerializedCas();
assertTrue(serializedCAS != null);
//
- JdUserErrorHandler eh = null;
- IJdUserDirective directive = null;
+ ErrorHandler eh = null;
+ IErrorHandlerDirective directive = null;
String plist = null;
int limit = 0;
//
- eh = new JdUserErrorHandler();
+ eh = new ErrorHandler();
directive = eh.handle(serializedCAS, getUserException());
assertTrue(directive.isKillJob() == false);
assertTrue(directive.isKillProcess() == false);
assertTrue(directive.isKillWorkItem() == true);
//
- eh = new JdUserErrorHandler();
+ eh = new ErrorHandler();
directive = eh.handle(serializedCAS, getUserException());
assertTrue(directive.isKillJob() == false);
assertTrue(directive.isKillProcess() == false);
assertTrue(directive.isKillWorkItem() == true);
//
limit = 15;
- eh = new JdUserErrorHandler();
+ eh = new ErrorHandler();
directive = eh.handle(serializedCAS, getUserException());
for(int i=1; i<limit; i++) {
directive = eh.handle(serializedCAS, getUserException());
@@ -268,7 +268,7 @@ public class TestSuite {
//
limit = 10;
plist = InitializationDataKey.KillJobLimit.name()+"="+limit;
- eh = new JdUserErrorHandler(plist);
+ eh = new ErrorHandler(plist);
directive = eh.handle(serializedCAS, getUserException());
for(int i=1; i<limit; i++) {
directive = eh.handle(serializedCAS, getUserException());
@@ -283,7 +283,7 @@ public class TestSuite {
//
limit = 20;
plist = InitializationDataKey.KillJobLimit.name()+"="+limit;
- eh = new JdUserErrorHandler(plist);
+ eh = new ErrorHandler(plist);
directive = eh.handle(serializedCAS, getUserException());
for(int i=1; i<limit; i++) {
directive = eh.handle(serializedCAS, getUserException());
@@ -307,10 +307,10 @@ public class TestSuite {
try {
//
String serializedCAS = null;
- TestJdUserErrorHandler eh = null;
- IJdUserDirective directive = null;
+ TestErrorHandler eh = null;
+ IErrorHandlerDirective directive = null;
//
- eh = new TestJdUserErrorHandler();
+ eh = new TestErrorHandler();
directive = eh.handle(serializedCAS, getUserException());
assertTrue(directive.isKillJob() == true);
assertTrue(directive.isKillProcess() == true);
Copied: uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestErrorHandler.java (from r1661659, uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java)
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestErrorHandler.java?p2=uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestErrorHandler.java&p1=uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java&r1=1661659&r2=1661765&rev=1661765&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestJdUserErrorHandler.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-user/src/test/java/org/apache/uima/ducc/user/jd/test/helper/TestErrorHandler.java Mon Feb 23 20:29:46 2015
@@ -18,19 +18,19 @@
*/
package org.apache.uima.ducc.user.jd.test.helper;
-import org.apache.uima.ducc.user.jd.iface.IJdUserDirective;
-import org.apache.uima.ducc.user.jd.iface.JdUserDirective;
-import org.apache.uima.ducc.user.jd.iface.JdUserErrorHandler;
+import org.apache.uima.ducc.ErrorHandler;
+import org.apache.uima.ducc.ErrorHandlerDirective;
+import org.apache.uima.ducc.IErrorHandlerDirective;
-public class TestJdUserErrorHandler extends JdUserErrorHandler {
+public class TestErrorHandler extends ErrorHandler {
@Override
- public IJdUserDirective handle(String serializedCAS, Object userException) {
- JdUserDirective jdUserDirective = new JdUserDirective();
- jdUserDirective.setKillJob();
- jdUserDirective.setKillProcess();
- jdUserDirective.resetKillWorkItem();
- return jdUserDirective;
+ public IErrorHandlerDirective handle(String serializedCAS, Object userException) {
+ ErrorHandlerDirective errorHandlerDirective = new ErrorHandlerDirective();
+ errorHandlerDirective.setKillJob();
+ errorHandlerDirective.setKillProcess();
+ errorHandlerDirective.resetKillWorkItem();
+ return errorHandlerDirective;
}
}