You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ch...@apache.org on 2013/05/24 23:45:21 UTC
svn commit: r1486228 - in /uima/sandbox/uima-ducc/trunk: ./ src/main/admin/
uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/
uima-ducc-examples/src/main/systemtest/
Author: challngr
Date: Fri May 24 21:45:21 2013
New Revision: 1486228
URL: http://svn.apache.org/r1486228
Log:
UIMA-2682 More javadac updates
Modified:
uima/sandbox/uima-ducc/trunk/javadoc.xml
uima/sandbox/uima-ducc/trunk/pom.xml
uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java
uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java
uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java
uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IUiOptions.java
uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/systemtest/runducc
Modified: uima/sandbox/uima-ducc/trunk/javadoc.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/javadoc.xml?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/javadoc.xml (original)
+++ uima/sandbox/uima-ducc/trunk/javadoc.xml Fri May 24 21:45:21 2013
@@ -55,7 +55,10 @@
</fileset>
<fileset dir="uima-ducc-cli/src/main/java">
+ <include name="**/DuccJobSubmit.java" />
<include name="**/DuccServiceApi.java" />
+ <include name="**/IDuccCallback.java" />
+ <include name="**/CliBase.java" />
</fileset>
</javadoc>
Modified: uima/sandbox/uima-ducc/trunk/pom.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/pom.xml?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/pom.xml (original)
+++ uima/sandbox/uima-ducc/trunk/pom.xml Fri May 24 21:45:21 2013
@@ -187,7 +187,8 @@
${basedir}/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceSubmit.java
${basedir}/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IDuccCallback.java
${basedir}/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IDuccMonitor.java
- ${basedir}/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IServiceApi.java
+ ${basedir}/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IDuccMonitor.java
+ ${basedir}/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java
</additionalparam>
Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py Fri May 24 21:45:21 2013
@@ -569,7 +569,7 @@ class DuccUtil:
verfile.close()
else:
print "ducc_ling version file missing, cannot verify version."
- return Ffalse;
+ return False;
print 'ducc_ling OK'
return True
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/CliBase.java Fri May 24 21:45:21 2013
@@ -45,6 +45,9 @@ import org.apache.uima.ducc.transport.di
import org.apache.uima.ducc.transport.event.AbstractDuccOrchestratorEvent;
import org.apache.uima.ducc.transport.event.IDuccContext.DuccContext;
+/**
+ * Define common methods and data used by all the DUCC API and CLI.
+ */
public abstract class CliBase
implements IUiOptions
{
@@ -52,8 +55,8 @@ public abstract class CliBase
private String myClassName = "N/A";
private boolean init_done = false;
protected String ducc_home;
- protected DuccProperties ducc_properties;
- protected DuccEventHttpDispatcher dispatcher;
+ DuccProperties ducc_properties;
+ DuccEventHttpDispatcher dispatcher;
protected Options options;
protected CommandLineParser parser;
@@ -69,8 +72,6 @@ public abstract class CliBase
protected boolean debug = false;
- protected abstract boolean execute() throws Exception;
-
protected ConsoleListener console_listener = null;
protected String host_address = "N/A";
protected boolean console_attach = false;
@@ -80,6 +81,15 @@ public abstract class CliBase
CountDownLatch waiter = null;
+ /**
+ * All extenders must implement execute - this method does whatever processing on the input
+ * is needed and passes the CLI request to the internal DUCC processes.
+ *
+ * @return Return true if execution works, and false otherwise.
+ * @throws java.lang.Exception The specific exception is a function of the implementor.
+ */
+ public abstract boolean execute() throws Exception;
+
String getLogDirectory(String extension)
{
/*
@@ -195,10 +205,6 @@ public abstract class CliBase
}
}
- /**
- * @param args - array of arguments to the cli parser
- * @param boolean - if true, then add tick to insure required args are present
- */
protected Options makeOptions(UiOption[] optlist, boolean strict)
{
Options opts = new Options();
@@ -506,13 +512,13 @@ public abstract class CliBase
}
/**
- * Set a property via the API.
+ * Set a property via the API. This method allows the API user to
+ * build up or override properties after the initial API object is constructed.
*
* @param key This is the property name.
* @param value This is the value of the property.
- * @param props This is the Properties objct to update.
*
- * @returns true if the property is set. Returns false if the property is not legal for this API.
+ * @return true if the property is set. Returns false if the property is not legal for this API.
*/
public boolean setProperty(String key, String value)
{
@@ -528,20 +534,29 @@ public abstract class CliBase
return true;
}
+ /**
+ * Return internal API debug status.
+ * @return True if the API debugging flag is set; false otherwise.
+ */
public boolean isDebug()
{
return debug;
}
+ /**
+ * Set the internal API debug flag.
+ * @param val Set to true to enable debugging, and false to disable it.
+ */
public void setDebug(boolean val)
{
this.debug = val;
}
- public String getHostAddress()
- {
- return host_address;
- }
+ // nobody seems to use this
+// public String getHostAddress()
+// {
+// return host_address;
+// }
public boolean hasProperty(String key)
{
@@ -578,8 +593,11 @@ public abstract class CliBase
}
}
- /*
- * Return code is only available when the monitor wait completes ... if not waiting then assume success
+ /**
+ * This returns the return code from the execution of the requested work. Return code is only
+ * available when the monitor wait completes ... if not waiting then assume success.
+ *
+ * @return The exit code of the job, process, etc.
*/
public int getReturnCode()
{
@@ -587,6 +605,11 @@ public abstract class CliBase
return returnCode;
}
+ /**
+ * This returns the unique numeric id for the requested work. For submissions (job, reservation, etc)
+ * this is the newly assigned id.
+ * @return The unique numeric id of the job, reservation, etc.
+ */
synchronized public long getDuccId()
{
return friendlyId;
@@ -732,14 +755,20 @@ public abstract class CliBase
}
}
+ /**
+ * This is used to find if the remote console is redirected to the local process, and if so, is it still
+ * active.
+ * @return True if the console is still attached to the remote process, false otherwise.
+ */
public boolean isConsoleAttached()
{
return ( (console_listener != null ) && ( !console_listener.isShutdown()));
}
/**
- * Wait for the listeners - maybe a console listener, maybe a job listener.
- * @returns true if a monitor wait was done, false otherwise. A monitor wait
+ * Wait for the listeners - maybe a console listener, maybe a job listener, maybe both.
+ *
+ * @return true if a monitor wait was done, false otherwise. A monitor wait
* results in a return code from the process. In all other cases
* the return code is spurious.
*/
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccJobSubmit.java Fri May 24 21:45:21 2013
@@ -46,7 +46,7 @@ public class DuccJobSubmit
// this.duccMessageProcessor = duccMessageProcessor;
// }
- public static UiOption[] opts_release = new UiOption[] {
+ static UiOption[] opts_release = new UiOption[] {
UiOption.Help,
UiOption.Debug,
UiOption.Timestamp,
@@ -98,7 +98,7 @@ public class DuccJobSubmit
UiOption.ClasspathOrder,
};
- public static UiOption[] opts_beta = new UiOption[] {
+ static UiOption[] opts_beta = new UiOption[] {
UiOption.Help,
UiOption.Debug,
UiOption.Timestamp,
@@ -160,30 +160,60 @@ public class DuccJobSubmit
private AllInOneLauncher allInOneLauncher = null;
+ /**
+ * @param args List of string arguments as described in the
+ * <a href="/doc/duccbook.html#DUCC_CLI_SUBMIT">DUCC CLI reference.</a>
+ */
public DuccJobSubmit(ArrayList<String> args)
throws Exception
{
this(args, null);
}
+ /**
+ * @param args Array of string arguments as described in the
+ * <a href="/doc/duccbook.html#DUCC_CLI_SUBMIT">DUCC CLI reference.</a>
+ */
public DuccJobSubmit(String[] args)
throws Exception
{
this(args, null);
}
+ /**
+ * @param props Properties file of arguments, as described in the
+ * <a href="/doc/duccbook.html#DUCC_CLI_SUBMIT">DUCC CLI reference.</a>
+ */
public DuccJobSubmit(Properties props)
throws Exception
{
this(props, null);
}
+ /**
+ * This form of the constructor allows the API user to capture
+ * messages, rather than directing them to stdout.
+ *
+ * @param args List of string arguments as described in the
+ * <a href="/doc/duccbook.html#DUCC_CLI_SUBMIT">DUCC CLI reference.</a>
+ * @param consoleCb If provided, messages are directed to it instead of
+ * stdout.
+ */
public DuccJobSubmit(ArrayList<String> args, IDuccCallback consoleCb)
throws Exception
{
this(args.toArray(new String[args.size()]), consoleCb);
}
+ /**
+ * This form of the constructor allows the API user to capture
+ * messages, rather than directing them to stdout.
+ *
+ * @param args Array of string arguments as described in the
+ * <a href="/doc/duccbook.html#DUCC_CLI_SUBMIT">DUCC CLI reference.</a>
+ * @param consoleCb If provided, messages are directed to it instead of
+ * stdout.
+ */
public DuccJobSubmit(String[] args, IDuccCallback consoleCb)
throws Exception
{
@@ -198,6 +228,15 @@ public class DuccJobSubmit
}
}
+ /**
+ * This form of the constructor allows the API user to capture
+ * messages, rather than directing them to stdout.
+ *
+ * @param props Properties file contianing string arguments as described in the
+ * <a href="/doc/duccbook.html#DUCC_CLI_SUBMIT">DUCC CLI reference.</a>
+ * @param consoleCb If provided, messages are directed to it instead of
+ * stdout.
+ */
public DuccJobSubmit(Properties props, IDuccCallback consoleCb)
throws Exception
{
@@ -419,6 +458,12 @@ public class DuccJobSubmit
//**********
+ /**
+ * Execute collects the job parameters, does basic error and correctness checking, and sends
+ * the job properties to the DUCC orchestrator for execution.
+ *
+ * @return True if the orchestrator accepts the job; false otherwise.
+ */
public boolean execute() throws Exception {
if(allInOneLauncher != null) {
return allInOneLauncher.execute();
@@ -580,8 +625,9 @@ public class DuccJobSubmit
return rc;
}
- /*
- * Return appropriate rc when job has completed
+ /**
+ * Return appropriate rc when job has completed.
+ * @return The exit code from the job.
*/
public int getReturnCode() {
if (allInOneLauncher != null) {
@@ -594,8 +640,9 @@ public class DuccJobSubmit
return jobRequestProperties.containsKey(UiOption.AllInOne.pname());
}
- /*
- * Main methid
+ /**
+ * Main method, as used by the executable jar or direct java invocation.
+ * @param args arguments as described in the <a href="/doc/duccbook.html#DUCC_CLI_JOB">DUCC CLI reference.</a>
*/
public static void main(String[] args) {
try {
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/DuccServiceApi.java Fri May 24 21:45:21 2013
@@ -38,7 +38,7 @@ import org.apache.uima.ducc.transport.ev
/**
- * This implements the DUCC service API. This class is also the implementation of the
+ * Handle registered services. This class is also the implementation of the
* DUCC service CLI which internally uses its API to implement itself. Details on the
* DUCC service CLI are found in the<a href="/doc/duccbook.html#DUCC_CLI_SERVICES">DUCC CLI reference.</a>
*/
@@ -567,7 +567,7 @@ public class DuccServiceApi
System.exit(1);
}
- protected boolean execute() { return false; }
+ public boolean execute() { return false; }
static boolean format_reply(UiOption verb, IServiceReply reply)
{
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IUiOptions.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IUiOptions.java?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IUiOptions.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-cli/src/main/java/org/apache/uima/ducc/cli/IUiOptions.java Fri May 24 21:45:21 2013
@@ -27,7 +27,7 @@ import org.apache.uima.ducc.transport.ev
import org.apache.uima.ducc.transport.event.cli.ServiceRequestProperties;
import org.apache.uima.ducc.transport.event.cli.SpecificationProperties;
-/**
+/*
* These are the constants supported by the 'not-using-a-props-file' form of registration in DuccServiceApi.
*
* There are here so that hopefully we can avoid touching anything in common or transport when updating
@@ -43,9 +43,9 @@ public interface IUiOptions
// argname() is a name for the argument for the usage() part of cli parser
//
- public static final int help_width = 120;
+ static final int help_width = 120;
- public enum UiOption
+ enum UiOption
{
Activate {
public String pname() { return "activate"; }
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/systemtest/runducc
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/systemtest/runducc?rev=1486228&r1=1486227&r2=1486228&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/systemtest/runducc (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/systemtest/runducc Fri May 24 21:45:21 2013
@@ -258,7 +258,6 @@ class DuccProcess(Thread):
CMD = CMD + ' --scheduling_class ' + pclass
CMD = CMD + ' --process_per_item_time_max ' + self.runner.process_timeout # in minutes
- CMD = CMD + ' --process_get_meta_time_max ' + self.runner.meta_timeout # in seconds
CMD = CMD + ' --process_initialization_failures_cap ' + self.runner.init_fail_cap
CMD = CMD + ' --process_environment ' \
@@ -680,9 +679,6 @@ class RunDucc(DuccUtil):
print ' -s --sourcetree'
print ' Run application from the DUCC source tree, not from the ducc_build pathing.'
print ''
- print ' -t, --timeout sec'
- print ' Meta_timeout in seconds. Defualt:', self.meta_timeout
- print ''
print ' --jd_uima_log log-properties'
print ' If specified, use the indicated properties file for JD UIMA/UIMA-AS logging. Default:', self.jd_uima_log
print ''
@@ -728,7 +724,6 @@ class RunDucc(DuccUtil):
self.memory_override = None
self.init_time = 10000
self.init_range = 1000
- self.meta_timeout = '5'
self.process_timeout = str(60*24) # 24 hour default - nothing in current megas will fail on this
self.style = 'AE'
self.service_pid = None
@@ -743,7 +738,7 @@ class RunDucc(DuccUtil):
self.use_ibm_package = False
self.submit_package = 'org.apache.uima.ducc'
- opts, args = getopt.getopt(argv, 'b:d:i:r:m:p:st:wx:y:?h', ['AE', 'DD', 'SE=', 'IB=', 'PB=', 'directory=', 'batchfile=', 'init_time=',
+ opts, args = getopt.getopt(argv, 'b:d:i:r:m:p:swx:y:?h', ['AE', 'DD', 'SE=', 'IB=', 'PB=', 'directory=', 'batchfile=', 'init_time=',
'init_fail_cap=', 'range=', 'memory_override=', 'process_timeout=',
'sourcetree', 'timeout=', 'watch',
'jd_uima_log=', 'jp_uima_log=',
@@ -766,8 +761,6 @@ class RunDucc(DuccUtil):
self.memory_override = a
elif o in ('-p', '--process_timeout'):
self.process_timeout = a
- elif o in ('-t', '--meta_timeout'):
- self.meta_timeout = a
elif o in ('-s', '--sourcetree'):
self.use_sourcetree = True
elif o in ('-w', '--watch' ):
@@ -816,7 +809,6 @@ class RunDucc(DuccUtil):
print ' watch :', self.watch
print ' error_rate :', self.error_rate
print ' init_error :', self.init_error
- print ' meta_timeout :', self.meta_timeout
print ' process_timeout :', self.process_timeout
print ' memory_override :', self.memory_override
print ' jd_uima_log :', self.jd_uima_log