This is an automated email from the ASF dual-hosted git repository.
seanfinan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ctakes.git
The following commit(s) were added to refs/heads/main by this push:
new 65afc7a DotLogger can accept and log intro messages Command Lines can
accept user-declared options in the format "++[name] [value]" PythonPipper has
parameter "RunPip"=yes/no CnlptNegation.piper uses ++pipCnlpt for RunPip Piper
variables $[name] can be used for any value. All piper variables $[name] can
also represent environment variables. Turned off log4j2 cleanup thread and
associated end-of-run "using SimpleLogger" warning. Got rid of unnecessary
Connection.stop() call in Pb [...]
65afc7a is described below
commit 65afc7a5b26c0eb64ca61c4d8c5373963f151486
Author: Sean Finan <[email protected]>
AuthorDate: Fri Dec 20 08:20:38 2024 -0500
DotLogger can accept and log intro messages
Command Lines can accept user-declared options in the format "++[name]
[value]"
PythonPipper has parameter "RunPip"=yes/no
CnlptNegation.piper uses ++pipCnlpt for RunPip
Piper variables $[name] can be used for any value.
All piper variables $[name] can also represent environment variables.
Turned off log4j2 cleanup thread and associated end-of-run "using
SimpleLogger" warning.
Got rid of unnecessary Connection.stop() call in Pbj sender and receiver.
Prevent repeat connection close attempts on PBJ sender and receiver in
cleanup threads.
mvn clean now cleans up ctakes module resources in resources/ directory,
allowing mvn compile to refresh them every time.
Remove ctakes.error.log on mvn clean
Added RunPip parameter to PythonPipper.
Updated PBJ configuration to use python > 3.7
Minor update for log statements - using {}
---
.../ctakes/core/ae/AbstractCommandRunner.java | 9 +-
.../org/apache/ctakes/core/ae/CtakesRunner.java | 14 +--
.../java/org/apache/ctakes/core/ae/ExitForcer.java | 4 +-
.../apache/ctakes/core/ae/PiperFileRunEngine.java | 5 +-
.../org/apache/ctakes/core/ae/PythonPipper.java | 31 ++++-
.../apache/ctakes/core/ae/inert/PausableAE.java | 8 +-
.../apache/ctakes/core/pipeline/CliOptionals.java | 9 ++
.../ctakes/core/pipeline/CliOptionalsHandler.java | 20 +++-
.../ctakes/core/pipeline/PiperFileReader.java | 128 ++++++++++++---------
.../ctakes/core/pipeline/PiperFileRunner.java | 25 +++-
.../apache/ctakes/core/util/PropertyAeFactory.java | 38 +++++-
.../org/apache/ctakes/core/util/log/DotLogger.java | 39 ++++++-
.../ctakes_cnlpt_py/pipeline/CnlptNegation.piper | 22 +++-
.../ctakes/examples/ctakes_cnlpt_py/setup.cfg | 9 +-
.../ctakes/examples/ctakes_cnlpt_py/setup.py | 2 +-
.../org/apache/ctakes/pbj/ae/PbjJmsSender.java | 21 ++--
.../java/org/apache/ctakes/pbj/ae/PbjPipper.java | 6 +-
.../java/org/apache/ctakes/pbj/ae/PbjSender.java | 10 +-
.../java/org/apache/ctakes/pbj/cr/PbjReceiver.java | 26 +++--
.../org/apache/ctakes/pbj/ctakes_pbj_py/setup.cfg | 5 +-
ctakes-type-system/src/user/config/log4j2.xml | 2 +-
pom.xml | 75 ++++++++++++
22 files changed, 371 insertions(+), 137 deletions(-)
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/AbstractCommandRunner.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/AbstractCommandRunner.java
index 90d9325..3779c2f 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/AbstractCommandRunner.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/AbstractCommandRunner.java
@@ -26,7 +26,6 @@ abstract public class AbstractCommandRunner extends
PausableFileLoggerAE {
name = CMD_PARAM,
description = CMD_DESC,
mandatory = false
-
)
private String _cmd;
@@ -101,8 +100,8 @@ abstract public class AbstractCommandRunner extends
PausableFileLoggerAE {
return ( commandDir == null || commandDir.isEmpty() ) ? command :
commandDir + File.separator + command;
}
- public void logInfo( final String info ) {
- LOGGER.info( info );
+ protected Logger getPauseLogger() {
+ return LOGGER;
}
/**
@@ -115,10 +114,10 @@ abstract public class AbstractCommandRunner extends
PausableFileLoggerAE {
_cmdDir = SystemUtil.subVariableParameters( _cmdDir, context );
_workDir = SystemUtil.subVariableParameters( _workDir, context );
if ( _cmdDir != null && !_cmdDir.isEmpty() && !new File( _cmdDir
).exists() ) {
- LOGGER.warn( "Cannot find Command Directory " + _cmdDir );
+ LOGGER.warn( "Cannot find Command Directory {}", _cmdDir );
}
if ( _workDir != null && !_workDir.isEmpty() && !new File( _workDir
).exists() ) {
- LOGGER.warn( "Cannot find Working Directory " + _workDir );
+ LOGGER.warn( "Cannot find Working Directory {}", _workDir );
}
if ( isCommandMandatory() && ( _cmd == null || _cmd.trim().isEmpty() ) )
{
throw new ResourceInitializationException( new IOException(
"Parameter " + CMD_PARAM + " must be set." ) );
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/CtakesRunner.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/CtakesRunner.java
index bdb3f62..6c04e27 100644
--- a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/CtakesRunner.java
+++ b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/CtakesRunner.java
@@ -39,14 +39,13 @@ public class CtakesRunner extends PausableFileLoggerAE {
static private final String JAVA_CMD = "-Xms512M -Xmx3g
org.apache.ctakes.core.pipeline.PiperFileRunner";
- private String _logFile;
protected boolean processPerDoc() {
return false;
}
- public void logInfo( final String info ) {
- LOGGER.info( info );
+ protected Logger getPauseLogger() {
+ return LOGGER;
}
@@ -117,13 +116,14 @@ public class CtakesRunner extends PausableFileLoggerAE {
protected void runCommand() throws IOException {
final String java_home = System.getProperty( "java.home" );
- final SystemUtil.CommandRunner runner =
- new SystemUtil.CommandRunner( "\"" + java_home + File.separator +
"bin" + File.separator
- + "java\" " + JAVA_CMD + " " +
_pipeline );
+ final String fullCommand = "\"" + java_home + File.separator + "bin" +
File.separator
+ + "java\" " + JAVA_CMD + " " + _pipeline;
+ final SystemUtil.CommandRunner runner = new SystemUtil.CommandRunner(
fullCommand );
final String logFile = getLogFile();
runner.setLogFiles( logFile );
// LOGGER.info( "Starting cTAKES with " + _cli + " ..." );
- LOGGER.info( "Starting external cTAKES pipeline with " + _pipeline + "
..." );
+ LOGGER.info( "Starting external cTAKES pipeline with {} ...", _pipeline
);
+// LOGGER.info( "Full command:\n{}", fullCommand );
SystemUtil.run( runner );
pause();
}
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/ExitForcer.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/ExitForcer.java
index 518fffd..27b0310 100644
--- a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/ExitForcer.java
+++ b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/ExitForcer.java
@@ -53,8 +53,8 @@ public class ExitForcer extends PausableAE {
// Do nothing
}
- protected void logInfo( final String info ) {
- LOGGER.info( info );
+ protected Logger getPauseLogger() {
+ return LOGGER;
}
/**
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PiperFileRunEngine.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PiperFileRunEngine.java
index 37988db..bdebccf 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PiperFileRunEngine.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PiperFileRunEngine.java
@@ -2,10 +2,7 @@ package org.apache.ctakes.core.ae;
import com.lexicalscope.jewel.cli.CliFactory;
import org.apache.ctakes.core.config.ConfigParameterConstants;
-import org.apache.ctakes.core.pipeline.CliOptionals;
-import org.apache.ctakes.core.pipeline.PipeBitInfo;
-import org.apache.ctakes.core.pipeline.PipelineBuilder;
-import org.apache.ctakes.core.pipeline.PiperFileReader;
+import org.apache.ctakes.core.pipeline.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.uima.UIMAException;
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PythonPipper.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PythonPipper.java
index 6762fd5..5eb0f46 100644
--- a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PythonPipper.java
+++ b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/PythonPipper.java
@@ -1,16 +1,16 @@
package org.apache.ctakes.core.ae;
import org.apache.ctakes.core.pipeline.PipeBitInfo;
-import org.apache.ctakes.core.util.MutableUimaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.uima.UimaContext;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
import org.apache.uima.fit.descriptor.ConfigurationParameter;
import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.ResourceInitializationException;
+import java.io.IOException;
+
/**
* @author SPF , chip-nlp
* @since {1/8/2024}
@@ -31,6 +31,16 @@ public class PythonPipper extends PythonRunner {
)
private String _pipPackage;
+ static public final String PIP_PARAM = "RunPip";
+ static public final String PIP_DESC = "Run pip on the given package. Set
to no if pip is unwanted.";
+ @ConfigurationParameter (
+ name = PIP_PARAM,
+ description = PIP_DESC,
+ mandatory = false,
+ defaultValue = "Yes"
+ )
+ private String _runPip;
+
/**
* {@inheritDoc}
@@ -47,6 +57,12 @@ public class PythonPipper extends PythonRunner {
public void process( final JCas jcas ) throws
AnalysisEngineProcessException {
}
+ private boolean runPip() {
+ return _runPip.isEmpty()
+ || _runPip.equalsIgnoreCase( "yes" )
+ || _runPip.equalsIgnoreCase( "true" );
+ }
+
/**
* Command is always pip.
* @return false
@@ -74,5 +90,16 @@ public class PythonPipper extends PythonRunner {
return true;
}
+ /**
+ * Only run if _pipPbj is yes.
+ * @throws IOException -
+ */
+ protected void runCommand() throws IOException {
+ if ( runPip() ) {
+ super.runCommand();
+ } else {
+ LOGGER.info( "Skipping pip of {}", _pipPackage );
+ }
+ }
}
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/inert/PausableAE.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/inert/PausableAE.java
index 11c5b9c..e72f53b 100644
--- a/ctakes-core/src/main/java/org/apache/ctakes/core/ae/inert/PausableAE.java
+++ b/ctakes-core/src/main/java/org/apache/ctakes/core/ae/inert/PausableAE.java
@@ -5,6 +5,7 @@ import org.apache.uima.UimaContext;
import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
import org.apache.uima.fit.descriptor.ConfigurationParameter;
import org.apache.uima.resource.ResourceInitializationException;
+import org.slf4j.Logger;
import java.io.IOException;
@@ -42,7 +43,9 @@ abstract public class PausableAE extends
JCasAnnotator_ImplBase {
super.initialize( context );
}
- protected void logInfo( final String info ) {}
+ protected Logger getPauseLogger() {
+ return null;
+ }
protected boolean shouldWait() {
return _wait.equalsIgnoreCase( "yes" ) || _wait.equalsIgnoreCase( "true"
);
@@ -53,8 +56,7 @@ abstract public class PausableAE extends
JCasAnnotator_ImplBase {
return;
}
final long pause = _pause * 1000L;
- logInfo( "Pausing " + _pause + " seconds ..." );
- try ( DotLogger dotter = new DotLogger() ) {
+ try ( DotLogger dotter = new DotLogger( getPauseLogger(), "Pausing {}
seconds ", _pause ) ) {
Thread.sleep( pause );
} catch ( IOException | InterruptedException multE ) {
// do nothing
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
index a07e391..f3ed42f 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
@@ -1,6 +1,9 @@
package org.apache.ctakes.core.pipeline;
import com.lexicalscope.jewel.cli.Option;
+import com.lexicalscope.jewel.cli.Unparsed;
+
+import java.util.List;
/**
* Defines command line interface single-character options that are not ctakes
defaults.
@@ -305,4 +308,10 @@ public interface CliOptionals extends StandardCliOptions {
defaultValue = "" )
String getOption_Z();
+ @Unparsed(
+ name = "UserDefined"
+// pattern = "(?:\\+\\+[a-zA-Z]+ [0-9a-zA-Z]+)"
+ )
+ List<String> getUserDefined();
+
}
\ No newline at end of file
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionalsHandler.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionalsHandler.java
index cd95a76..57da199 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionalsHandler.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionalsHandler.java
@@ -3,6 +3,8 @@ package org.apache.ctakes.core.pipeline;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
+import java.util.List;
+
/**
* @author SPF , chip-nlp
@@ -20,11 +22,11 @@ final public class CliOptionalsHandler {
* Brute force method to get option values
*
* @param optionals -
- * @param optionChar character option
+ * @param name character option
* @return the value specified on the command line for the given character
*/
- static public String getCliOptionalValue( final CliOptionals optionals,
final String optionChar ) {
- switch ( optionChar ) {
+ static public String getCliOptionalValue( final CliOptionals optionals,
final String name ) {
+ switch ( name ) {
case "i":
return optionals.getInputDirectory();
case "o":
@@ -156,7 +158,17 @@ final public class CliOptionalsHandler {
case "Z":
return optionals.getOption_Z();
}
- LOGGER.warn( "No value specified on command line for " + optionChar );
+ final List<String> userDefined = optionals.getUserDefined();
+ if ( userDefined != null ) {
+ for ( int i = 0; i < userDefined.size() - 1; i++ ) {
+ if ( userDefined.get( i ).equals( "++" + name ) ) {
+ LOGGER.debug( "Using value \"{}\" for dynamic command line
parameter \"++{}\"", userDefined.get( i + 1 ),
+ name );
+ return userDefined.get( i + 1 );
+ }
+ }
+ }
+ LOGGER.warn( "No value specified on command line for parameter \"{}\"",
name );
return "";
}
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
index 3a4935e..e4f2441 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
@@ -112,15 +112,15 @@ final public class PiperFileReader {
* @param filePath path to the pipeline command file
*/
public boolean loadPipelineFile( final String filePath ) throws
UIMAException {
- LOGGER.info( "Loading Piper File " + filePath + " ..." );
- try ( final BufferedReader reader = getPiperReader( filePath );
DotLogger logger = new DotLogger() ) {
+ try ( final BufferedReader reader = getPiperReader( filePath );
+ DotLogger logger = new DotLogger( LOGGER, "Loading Piper File {}
", filePath) ) {
String line = reader.readLine();
while ( line != null ) {
parsePipelineLine( line.trim() );
line = reader.readLine();
}
} catch ( IOException ioE ) {
- LOGGER.error( "Could not read piper file: " + filePath );
+ LOGGER.error( "Could not read piper file: {}", filePath );
throw new UIMAException( ioE );
}
return true;
@@ -155,109 +155,131 @@ final public class PiperFileReader {
final Collection<String> viewSpecs = getViewSpecs( parameter );
final Collection<String> views = getViews( viewSpecs );
final String info = removeViewSpecs( parameter, viewSpecs );
- switch ( command ) {
- case "load":
- return loadPipelineFile( info );
- case "package":
+ return switch ( command ) {
+ case "load" -> loadPipelineFile( info );
+ case "package" -> {
PipeBitLocator.getInstance()
.addUserPackage( info );
- return true;
- case "set":
+ yield true;
+ }
+ case "set" -> {
_builder.set( splitParameters( info ) );
- return true;
- case "cli":
+ yield true;
+ }
+ case "cli" -> {
_builder.setIfEmpty( getCliParameters( info ) );
- return true;
- case "env":
+ yield true;
+ }
+ case "env" -> {
_builder.env( splitParameters( info ) );
- return true;
- case "reader":
+ yield true;
+ }
+ case "reader" -> {
if ( hasParameters( info ) ) {
final String[] component_parameters = splitFromParameters( info
);
final String component = component_parameters[ 0 ];
final Object[] parameters = splitParameters(
component_parameters[ 1 ] );
_builder.reader( PipeBitLocator.getInstance()
.getReaderClass( component ),
parameters );
- } else {
+ }
+ else {
_builder.reader( PipeBitLocator.getInstance()
.getReaderClass( info ) );
}
- return true;
- case "readFiles":
+ yield true;
+ }
+ case "readFiles" -> {
if ( info.isEmpty() ) {
_builder.readFiles();
- } else {
+ }
+ else {
_builder.readFiles( info );
}
- return true;
- case "add":
+ yield true;
+ }
+ case "add" -> {
if ( hasParameters( info ) ) {
final String[] component_parameters = splitFromParameters( info
);
final String component = component_parameters[ 0 ];
final Object[] parameters = splitParameters(
component_parameters[ 1 ] );
_builder.add( PipeBitLocator.getInstance().getComponentClass(
component ), views, parameters );
- } else {
+ }
+ else {
_builder.add( PipeBitLocator.getInstance().getComponentClass(
info ), views );
}
- return true;
- case "addLogged":
+ yield true;
+ }
+ case "addLogged" -> {
if ( hasParameters( info ) ) {
final String[] component_parameters = splitFromParameters( info
);
final String component = component_parameters[ 0 ];
final Object[] parameters = splitParameters(
component_parameters[ 1 ] );
_builder.addLogged(
PipeBitLocator.getInstance().getComponentClass( component ), views, parameters
);
- } else {
+ }
+ else {
_builder.addLogged(
PipeBitLocator.getInstance().getComponentClass( info ), views );
}
- return true;
- case "addDescription":
+ yield true;
+ }
+ case "addDescription" -> {
if ( hasParameters( info ) ) {
final String[] descriptor_parameters = splitFromParameters(
info );
final String component = descriptor_parameters[ 0 ];
final Object[] values = splitDescriptorValues(
descriptor_parameters[ 1 ] );
- final AnalysisEngineDescription description =
PipeBitLocator.getInstance().createDescription( component, values );
+ final AnalysisEngineDescription description =
+ PipeBitLocator.getInstance().createDescription(
component, values );
_builder.addDescription( description, views );
- } else {
+ }
+ else {
final AnalysisEngineDescription description =
PipeBitLocator.getInstance().createDescription( info );
_builder.addDescription( description, views );
}
- return true;
- case "addLast":
+ yield true;
+ }
+ case "addLast" -> {
if ( hasParameters( info ) ) {
final String[] component_parameters = splitFromParameters( info
);
final String component = component_parameters[ 0 ];
final Object[] parameters = splitParameters(
component_parameters[ 1 ] );
_builder.addLast(
PipeBitLocator.getInstance().getComponentClass( component ), views, parameters
);
- } else {
+ }
+ else {
_builder.addLast(
PipeBitLocator.getInstance().getComponentClass( info ), views );
}
- return true;
- case "threads":
- return setThreadCount( info );
- case "collectCuis":
+ yield true;
+ }
+ case "threads" -> setThreadCount( info );
+ case "collectCuis" -> {
_builder.collectCuis();
- return true;
- case "collectEntities":
+ yield true;
+ }
+ case "collectEntities" -> {
_builder.collectEntities();
- return true;
- case "writeXmis":
+ yield true;
+ }
+ case "writeXmis" -> {
if ( info.isEmpty() ) {
_builder.writeXMIs();
- } else {
+ }
+ else {
_builder.writeXMIs( info );
}
- return true;
- case "writeHtml":
+ yield true;
+ }
+ case "writeHtml" -> {
if ( info.isEmpty() ) {
_builder.writeHtml();
- } else {
+ }
+ else {
_builder.writeHtml( info );
}
- return true;
- default:
- LOGGER.error( "Unknown Piper Command: " + command );
- return false;
- }
+ yield true;
+ }
+ default -> {
+ LOGGER.error( "Unknown Piper Command: {}", command );
+ yield false;
+ }
+ };
}
private boolean setThreadCount( final String info ) {
@@ -266,7 +288,7 @@ final public class PiperFileReader {
_builder.threads( (Integer) count );
return true;
}
- LOGGER.error( "Could not parse thread count from " + info );
+ LOGGER.error( "Could not parse thread count from {}", info );
return false;
}
@@ -327,7 +349,7 @@ final public class PiperFileReader {
return stream;
}
}
- LOGGER.error( "No piper file found for " + filePath );
+ LOGGER.error( "No piper file found for {}", filePath );
return null;
}
@@ -387,7 +409,7 @@ final public class PiperFileReader {
i += 2;
continue;
} else if ( keyAndValue.length > 2 ) {
- LOGGER.warn( "Multiple parameter values, using first of " + pair );
+ LOGGER.warn( "Multiple parameter values, using first of {}", pair
);
}
keysAndValues[ i + 1 ] = getValueObject( keyAndValue[ 1 ] );
i += 2;
@@ -429,7 +451,7 @@ final public class PiperFileReader {
i += 2;
continue;
} else if ( keyAndValue.length > 2 ) {
- LOGGER.warn( "Multiple parameter values, using first of " + pair );
+ LOGGER.warn( "Multiple parameter values, using first of {}", pair
);
}
keysAndValues[ i + 1 ] = getValueObject( CliOptionalsHandler
.getCliOptionalValue( _cliOptionals, keyAndValue[ 1 ] ) );
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
index 60abe2a..18fd568 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
@@ -17,6 +17,23 @@ import java.util.Arrays;
import java.util.stream.Collectors;
/**
+ * Runs the pipeline in the piper file specified by -p (piperfile)
+ * with any other provided arguments. Standard arguments are:
+ * -i , --inputDir {inputDirectory}
+ * -o , --outputDir {outputDirectory}
+ * -s , --subDir {subDirectory} (for i/o)
+ * --xmiOut {xmiOutputDirectory} (if different from -o)
+ * -l , --lookupXml {dictionaryConfigFile} (fast only)
+ * --key {umlsKey}
+ * -? , --help
+ * Other parameters may be declared in the piper file using the cli command:
+ * cli {parameterName}={singleCharacter}
+ * For instance, for declaration of ParagraphAnnotator path to regex file
optional parameter PARAGRAPH_TYPES_PATH,
+ * in the custom piper file add the line:
+ * cli PARAGRAPH_TYPES_PATH=t
+ * and when executing this class use:
+ * PiperFileRunner( -p, path/to/my/custom.piper, -t,
path/to/my/custom.bsv ... );
+ *
* @author SPF , chip-nlp
* @version %I%
* @since 10/13/2016
@@ -102,14 +119,14 @@ final public class PiperFileRunner {
try {
final PrintStream stream = new PrintStream( logPath );
multE.printStackTrace( stream );
- LOGGER.info( "\nFor more information please see log file " +
logPath );
+ LOGGER.info( "\nFor more information please see log file {}",
logPath );
LOGGER.info( "This is a log file on your machine listing
information that may be useful in debugging your failed run." );
LOGGER.info(
- "Seriously, don't ignore this message. If you want to get
to the root of a problem, check the error log file " +
+ "Seriously, don't ignore this message. If you want to get
to the root of a problem, check the error log file {}",
logPath );
} catch ( FileNotFoundException fnfE ) {
- LOGGER.warn( "Could not write to log file " + logPath );
- multE.printStackTrace();
+ LOGGER.warn( "Could not write to log file {}", logPath );
+ Arrays.stream( multE.getStackTrace() ).map( Object::toString
).forEach( LOGGER::warn );
}
return false;
}
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/util/PropertyAeFactory.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/util/PropertyAeFactory.java
index 7a84e3c..17d9672 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/util/PropertyAeFactory.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/util/PropertyAeFactory.java
@@ -44,7 +44,7 @@ public enum PropertyAeFactory {
_typeSystemDescription =
TypeSystemDescriptionFactory.createTypeSystemDescription();
} catch ( ResourceInitializationException riE ) {
LoggerFactory.getLogger( "PropertyAeFactory" )
- .error( "Could not initialize cTAKES Type System\n" +
riE.getMessage() );
+ .error( "Could not initialize cTAKES Type System\n{}",
riE.getMessage() );
System.exit( -1 );
}
}
@@ -85,12 +85,11 @@ public enum PropertyAeFactory {
if ( parameters[ i ] instanceof String ) {
name = (String) parameters[ i ];
} else {
- LOGGER.warn( "Parameter " + i + " not a String, using " +
parameters[ i ].toString() );
+ LOGGER.warn( "Parameter {} not a String, using {}", i, parameters[
i ].toString() );
name = parameters[ i ].toString();
}
if ( _properties.containsKey( name ) && parameters[ i + 1
].toString().isEmpty() ) {
- LOGGER.info( "Parameter " + name + " has value " +
_properties.get( name )
- + " ; ignoring empty value" );
+ LOGGER.info( "Parameter {} has value {} ; ignoring empty value",
name, _properties.get( name ) );
continue;
}
_properties.put( name, parameters[ i + 1 ] );
@@ -106,7 +105,12 @@ public enum PropertyAeFactory {
int i = 0;
for ( Map.Entry<String, Object> entry : parameterMap.entrySet() ) {
parameters[ i ] = entry.getKey();
- parameters[ i + 1 ] = entry.getValue();
+ final Object value = subVariableParameter( entry.getValue(),
parameterMap );
+ if ( !value.equals( entry.getValue() ) ) {
+ LOGGER.info( "Substituting Parameter Value \"{}\" for \"{}\" on
Parameter \"{}\"", value, entry.getValue(),
+ entry.getKey() );
+ }
+ parameters[ i + 1 ] = value;
i += 2;
}
return parameters;
@@ -132,6 +136,28 @@ public enum PropertyAeFactory {
return createParameters( parameterMap );
}
+ static public Object subVariableParameter( final Object parameterValue,
final Map<String,Object> parameterMap ) {
+ if ( parameterMap == null || !(parameterValue instanceof String) ) {
+ return parameterValue;
+ }
+ final String textValue = parameterValue.toString();
+ if ( !textValue.startsWith( "$" ) ) {
+ return parameterValue;
+ }
+ final String varName = textValue.substring( 1 );
+ final Object subValue = parameterMap.get( varName );
+ if ( subValue == null ) {
+ // Check for an environment variable.
+ final String envValue = System.getenv( varName );
+ if ( envValue != null ) {
+ return envValue;
+ }
+ LOGGER.warn( "No value for unknown substitution variable ${}",
varName );
+ return parameterValue;
+ }
+ return subValue;
+ }
+
/**
* @param readerClass Collection Reader class
* @param parameters parameters for the main component
@@ -221,7 +247,7 @@ public enum PropertyAeFactory {
if ( parameters[ i ] instanceof String ) {
map.put( (String) parameters[ i ], parameters[ i + 1 ] );
} else {
- LOGGER.warn( "Parameter " + i + " not a String, using " +
parameters[ i ].toString() );
+ LOGGER.warn( "Parameter {} not a String, using {}", i, parameters[
i ].toString() );
map.put( parameters[ i ].toString(), parameters[ i + 1 ] );
}
}
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/util/log/DotLogger.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/util/log/DotLogger.java
index a7d208f..c18c2b6 100644
--- a/ctakes-core/src/main/java/org/apache/ctakes/core/util/log/DotLogger.java
+++ b/ctakes-core/src/main/java/org/apache/ctakes/core/util/log/DotLogger.java
@@ -5,6 +5,8 @@ import org.slf4j.Logger;
import java.io.Closeable;
import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.TimerTask;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -23,17 +25,46 @@ final public class DotLogger implements Closeable {
static private final Logger DOT_LOGGER = LoggerFactory.getLogger(
"ProgressAppender" );
static private final Logger EOL_LOGGER = LoggerFactory.getLogger(
"ProgressDone" );
+ static private final DateFormat DATE_FORMAT = new SimpleDateFormat( "dd MMM
yyyy hh:mm:ss" );
+
private final ExecutorService _timer;
/**
- * Starts the Dot Logging
+ * Starts the Dot Logging.
*/
public DotLogger() {
+ this( "" );
+ }
+
+ /**
+ * @param message a message to log before dots.
+ * @param arguments any arguments for substitution in the message.
+ * Starts the Dot Logging with a starting message.
+ */
+ public DotLogger( final String message, final Object ... arguments ) {
+ this( null, message, arguments );
+ }
+
+ /**
+ * @param logger a specific logger to use for the message.
+ * @param message a message to log before dots.
+ * @param arguments any arguments for substitution in the message.
+ * Starts the Dot Logging with a starting message.
+ */
+ public DotLogger( final Logger logger, final String message, final Object
... arguments ) {
+ if ( !message.isEmpty() ) {
+ DOT_LOGGER.info( createMessage( logger, message ), arguments );
+ }
_timer = Executors.newScheduledThreadPool( 1 );
((ScheduledExecutorService)_timer).scheduleAtFixedRate(
new DotPlotter(), 500, 500, TimeUnit.MILLISECONDS );
}
+ static private String createMessage( final Logger logger, final String
message ) {
+ return DATE_FORMAT.format( System.currentTimeMillis() ) + " INFO "
+ + ((logger == null) ? "" : logger.getName()) + " - " + message;
+ }
+
/**
* {@inheritDoc}
*/
@@ -43,7 +74,7 @@ final public class DotLogger implements Closeable {
EOL_LOGGER.info( "" );
}
- private class DotPlotter extends TimerTask {
+ private static class DotPlotter extends TimerTask {
private int _count = 0;
@Override
@@ -52,9 +83,9 @@ final public class DotLogger implements Closeable {
_count++;
if ( _count % 60 == 0 ) {
if ( _count % 120 == 0 ) {
- EOL_LOGGER.info( " " + (_count / 2) );
+ EOL_LOGGER.info( " {}", _count / 2 );
} else {
- DOT_LOGGER.info( " " + (_count / 2) + " " );
+ DOT_LOGGER.info( " {} ", _count / 2 );
}
}
}
diff --git
a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
index 0cf9677..5e298e7 100644
---
a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
+++
b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/pipeline/CnlptNegation.piper
@@ -42,12 +42,24 @@ add CtakesRunner Pipeline="-p PbjThirdStep -o
$OutputDirectory -a $ArtemisBroker
// Start the python bit of the full pipeline.
//
-// pip the cnlp_transformers project and its dependencies.
-//add PythonRunner Command="-m pip install
resources/org/apache/ctakes/examples/ctakes_cnlpt_py/" Wait=yes
-add PythonPipper
PipPackage="resources/org/apache/ctakes/examples/ctakes_cnlpt_py/" Wait=yes
+// An explanation of the following command "cli PipCnlpt=pipCnlpt" :
+// Set the value of a user-declared variable to a value coming from the
command line.
+// Unlike other parameter names (e.g. OutputDirectory), PipCnlpt (uppercase P)
is not defined in cTAKES.
+// The user is declaring it, and thus it is so. It can be used in this piper
file.
-// There is a fixed order to queue specification in python pipelines.
-// The incoming (receiver) queue is named first, the outgoing (sender) queue
is named second.
+// The user is also declaring a command line option named "pipCnlpt"
(lowercase p).
+// This is not a standard command line parameter like --pipPbj, -i or -o.
+// If used, it will need to be declared on the command line with double plus
++ instead of double minus --.
+// It will also need to be at the end of the command. It cannot be before
other command line parameters.
+// [rest of command] ++pipCnlpt yes/no
+
+// Set the user-declared piper variable "PipCnlpt" to have the same value of
command line option "++pipCnlpt"
+cli PipCnlpt=pipCnlpt
+
+// pip the cnlp_transformers project and its dependencies. Note the use of
variable $PipCnlpt as value for RunPip.
+add PythonPipper
PipPackage="resources/org/apache/ctakes/examples/ctakes_cnlpt_py/" Wait=yes
RunPip=$PipCnlpt
+
+// Start a PBJ python pipeline for cnlp_transformers Negation.
// TODO: Right now cnlpt isn't using --output_dir. Need to figure out why.
add PythonRunner Command="-m ctakes_cnlpt.negation_pipeline --receive_queue
JavaToPy --send_queue PyToJava --output_dir $OutputDirectory"
LogFile=negation_pipeline.log
diff --git
a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.cfg
b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.cfg
index cecaaa9..d733880 100644
---
a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.cfg
+++
b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = ctakes-cnlpt
-version = 7.0.0-SNAPSHOT
+version = 7.0.0
author = Apache cTAKES
author_email = [email protected]
description = Apache cTAKES Clinical NLP Transformers example
@@ -10,8 +10,7 @@ url = https://github.com/apache/ctakes
project_urls =
Bug Tracker = https://github.com/apache/ctakes/issues
classifiers =
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
+ Programming Language :: Python :: 3
Operating System :: OS Independent
License :: OSI Approved :: Apache Software License
@@ -19,9 +18,9 @@ classifiers =
package_dir=
= src
packages = find:
-python_requires = >=3.7, <3.9
+python_requires = >=3.7
install_requires =
- ctakes_pbj~=7.0.0-SNAPSHOT
+ ctakes_pbj~=7.0.0
cnlp-transformers~=0.4.0
[options.packages.find]
diff --git
a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.py
b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.py
index f2fc541..7dd5084 100644
---
a/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.py
+++
b/ctakes-examples/src/user/resources/org/apache/ctakes/examples/ctakes_cnlpt_py/setup.py
@@ -2,4 +2,4 @@ from distutils.core import setup
from setuptools import find_packages
-setup(name='ctakes_cnlpt', version='7.0.0-SNAPSHOT', packages=find_packages())
+setup(name='ctakes_cnlpt', version='7.0.0', packages=find_packages())
diff --git
a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjJmsSender.java
b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjJmsSender.java
index e6302ae..b2e1d34 100644
--- a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjJmsSender.java
+++ b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjJmsSender.java
@@ -97,7 +97,7 @@ public class PbjJmsSender extends PbjSender {
return true;
}
}
- LOGGER.info( "Queued Message Count = " + count );
+ LOGGER.info( "Queued Message Count = {}", count );
return false;
}
@@ -124,9 +124,8 @@ public class PbjJmsSender extends PbjSender {
*/
@Override
protected void connect() throws ResourceInitializationException {
- try {
+ try ( DotLogger dotter = new DotLogger( LOGGER, "Connecting PBJ Sender
on {} {} ", _host, _queue ) ) {
final InitialContext initialContext = new InitialContext();
- LOGGER.info( "Connecting PBJ Sender on " + _host + " " + _queue + "
..." );
final ActiveMQConnectionFactory cf
= new ActiveMQConnectionFactory( "tcp://" + _host + ":" + _port
);
// Time To Live TTL of -1 asks server to never close this connection.
@@ -140,7 +139,7 @@ public class PbjJmsSender extends PbjSender {
_producer.setTimeToLive( 300000 );
_connection.start();
_queueBrowser = _session.createBrowser( queue );
- } catch ( NamingException | JMSException multE ) {
+ } catch ( NamingException | JMSException | IOException multE ) {
throw new ResourceInitializationException( multE );
}
}
@@ -151,12 +150,16 @@ public class PbjJmsSender extends PbjSender {
*/
@Override
protected void disconnect() throws AnalysisEngineProcessException {
- try {
- _connection.stop();
+ if ( _connection == null ) {
+ return;
+ }
+ try ( DotLogger dotter = new DotLogger( LOGGER, "Disconnecting PBJ
Sender on {} {} ", _host, _queue ) ) {
_connection.close();
- LOGGER.info( "Disconnected PBJ Sender on " + _host + " " + _queue + "
..." );
- } catch ( JMSException jmsE ) {
- throw new AnalysisEngineProcessException( jmsE );
+ _connection = null;
+ } catch ( JMSException | IOException multE ) {
+ LOGGER.error( multE.getMessage() );
+ _connection = null;
+ throw new AnalysisEngineProcessException( multE );
}
}
diff --git a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjPipper.java
b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjPipper.java
index 921452c..f565537 100644
--- a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjPipper.java
+++ b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjPipper.java
@@ -53,7 +53,7 @@ public class PbjPipper extends PythonRunner {
public void process( final JCas jcas ) throws
AnalysisEngineProcessException {
}
- private boolean doPip() {
+ private boolean runPip() {
return _pipPbj.isEmpty()
|| _pipPbj.equalsIgnoreCase( "yes" )
|| _pipPbj.equalsIgnoreCase( "true" );
@@ -92,11 +92,13 @@ public class PbjPipper extends PythonRunner {
* @throws IOException -
*/
protected void runCommand() throws IOException {
- if ( doPip() ) {
+ if ( runPip() ) {
LOGGER.info( "Since ctakes-pbj is pip installed from source, pip will
always perform an install." );
LOGGER.info( "To turn off the pip use \"set " + PIP_PBJ_PARAM +
"=no\" in your piper file" );
LOGGER.info( " or add \"--pipPbj no\" to your command line." );
super.runCommand();
+ } else {
+ LOGGER.info( "Skipping pip of PBJ" );
}
}
diff --git a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjSender.java
b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjSender.java
index 6d16689..f7fcd2b 100644
--- a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjSender.java
+++ b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/ae/PbjSender.java
@@ -155,7 +155,7 @@ abstract public class PbjSender extends
JCasAnnotator_ImplBase {
try {
setPort( Integer.parseInt( port ) );
} catch (NumberFormatException nfE ) {
- LOGGER.warn( "Couldn't set Port on Sender " + nfE.getMessage() );
+ LOGGER.warn( "Couldn't set Port on Sender {}", nfE.getMessage() );
}
}
@@ -182,7 +182,7 @@ abstract public class PbjSender extends
JCasAnnotator_ImplBase {
try {
setQueueSize( Integer.parseInt( queueSize ) );
} catch (NumberFormatException nfE ) {
- LOGGER.warn( "Couldn't set Queue size " + nfE.getMessage() );
+ LOGGER.warn( "Couldn't set Queue size {}", nfE.getMessage() );
}
}
@@ -206,7 +206,6 @@ abstract public class PbjSender extends
JCasAnnotator_ImplBase {
@Override
public void initialize( final UimaContext context ) throws
ResourceInitializationException {
super.initialize( context );
- LOGGER.info( "Starting PBJ Sender on " + _host + " " + _queue + " ..." );
_id = createID();
connect();
registerShutdownHook();
@@ -218,7 +217,7 @@ abstract public class PbjSender extends
JCasAnnotator_ImplBase {
*/
@Override
public void process( final JCas jcas ) throws
AnalysisEngineProcessException {
- LOGGER.info( "Sending processed information to " + _host + " " + _queue
+ " ..." );
+ LOGGER.info( "Sending processed information to {} {} ...", _host, _queue
);
// waitOnQueue();
sendJCas( jcas );
}
@@ -286,10 +285,11 @@ abstract public class PbjSender extends
JCasAnnotator_ImplBase {
if ( !_sendStop.equalsIgnoreCase( "yes" ) ) {
return;
}
- LOGGER.info( "Sending Stop code to " + _host + " " + _queue + " ..." );
+ LOGGER.info( "Sending Stop code to {} {} ...", _host, _queue );
try {
// TODO send stop as MULTICAST to stop all receivers on the queue.
v6 ?
sendText( STOP_MESSAGE );
+ _sendStop = "no";
} catch ( AnalysisEngineProcessException ioE ) {
throw new AnalysisEngineProcessException( ioE );
}
diff --git a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/cr/PbjReceiver.java
b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/cr/PbjReceiver.java
index a23be73..9769d84 100644
--- a/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/cr/PbjReceiver.java
+++ b/ctakes-pbj/src/main/java/org/apache/ctakes/pbj/cr/PbjReceiver.java
@@ -5,6 +5,7 @@ import
org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQQueue;
import org.apache.ctakes.core.pipeline.PipeBitInfo;
import org.apache.ctakes.core.util.doc.JCasBuilder;
+import org.apache.ctakes.core.util.log.DotLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.uima.UimaContext;
@@ -140,9 +141,9 @@ final public class PbjReceiver extends
JCasCollectionReader_ImplBase {
@Override
public void initialize( final UimaContext context ) throws
ResourceInitializationException {
super.initialize( context );
- try {
+ try ( DotLogger dotter = new DotLogger( LOGGER,
+ "Starting Python Bridge to Java Receiver on {} {} ", _host, _queue
) ){
InitialContext initialContext = new InitialContext();
- LOGGER.info( "Starting Python Bridge to Java Receiver on " + _host +
" " + _queue + " ..." );
final ActiveMQConnectionFactory cf
= new ActiveMQConnectionFactory( "tcp://" + _host + ":" + _port
);
// Time To Live TTL of -1 asks server to never close this connection.
@@ -155,7 +156,7 @@ final public class PbjReceiver extends
JCasCollectionReader_ImplBase {
_consumer = session.createConsumer( queue );
_connection.start();
registerShutdownHook();
- } catch ( NamingException | JMSException multE ) {
+ } catch ( NamingException | JMSException | IOException multE ) {
throw new ResourceInitializationException( multE );
}
}
@@ -210,9 +211,8 @@ final public class PbjReceiver extends
JCasCollectionReader_ImplBase {
} else if ( message instanceof ActiveMQBytesMessage ) {
text = readBytesMessage( (BytesMessage) message );
} else if ( message != null ) {
- LOGGER.error( "Received unexpected message format " +
message.getClass()
-
.getName()
- + "\n" + message.toString() + "\nProcessing Empty
Document." );
+ LOGGER.error( "Received unexpected message format
{}\n{}\nProcessing Empty Document.",
+ message.getClass().getName(), message.toString() );
text = EMPTY_CAS;
}
if ( !text.isEmpty() ) {
@@ -242,15 +242,17 @@ final public class PbjReceiver extends
JCasCollectionReader_ImplBase {
public void disconnect() {
- try {
- _connection.stop();
+ if ( _connection == null ) {
+ return;
+ }
+ try ( DotLogger dotter = new DotLogger( LOGGER, "Disconnecting PBJ
Receiver on {} {} ", _host, _queue ) ){
_connection.close();
- LOGGER.info( "Disconnected PBJ Receiver on " + _host + " " + _queue +
" ..." );
- } catch ( JMSException jmsE ) {
- if ( jmsE.getMessage().equalsIgnoreCase( "Connection is closed" ) ) {
+ _connection = null;
+ } catch ( JMSException | IOException multE ) {
+ if ( multE.getMessage().equalsIgnoreCase( "Connection is closed" ) ) {
return;
}
- LOGGER.info( "Artemis Disconnect: " + jmsE.getMessage() );
+ LOGGER.warn( "Artemis Disconnect: {}", multE.getMessage() );
}
}
diff --git
a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/setup.cfg
b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/setup.cfg
index 1f53592..0fffc1d 100644
---
a/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/setup.cfg
+++
b/ctakes-pbj/src/user/resources/org/apache/ctakes/pbj/ctakes_pbj_py/setup.cfg
@@ -10,8 +10,7 @@ url = https://github.com/apache/ctakes
project_urls =
Bug Tracker = https://github.com/apache/ctakes/issues
classifiers =
- Programming Language :: Python :: 3.7
- Programming Language :: Python :: 3.8
+ Programming Language :: Python :: 3
Operating System :: OS Independent
License :: OSI Approved :: Apache Software License
@@ -19,7 +18,7 @@ classifiers =
package_dir=
= src
packages = find:
-python_requires = >=3.7, <3.9
+python_requires = >=3.7
install_requires =
dkpro-cassis~=0.9.1
stomp-py~=8.1.2
diff --git a/ctakes-type-system/src/user/config/log4j2.xml
b/ctakes-type-system/src/user/config/log4j2.xml
index 28bed75..e664bf5 100644
--- a/ctakes-type-system/src/user/config/log4j2.xml
+++ b/ctakes-type-system/src/user/config/log4j2.xml
@@ -19,7 +19,7 @@
under the License.
-->
-<Configuration status="info">
+<Configuration status="info" shutdownHook="disable">
<Appenders>
<Console name="consoleAppender" target="SYSTEM_OUT">
<PatternLayout pattern="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} -
%m%n"/>
diff --git a/pom.xml b/pom.xml
index f169483..66a36a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1369,6 +1369,81 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
+ <configuration>
+ <filesets>
+ <!-- Clean up the resources directory so that mvn
compile regenerates with any changes.
+ Use individual ctakes modules.
+ Do not use universal ctakes/ alone as user may add
their own module. -->
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/assertion</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/chunker</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/clinical</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/constituency</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/core</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/coreference</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/dependency</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/dictionary</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/examples</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/lvg</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/ne</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/pbj</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/pos</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/postagger</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/relation</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/sideeffect</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/smoking</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/temporal</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/apache/ctakes/utils</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/mitre/medfacts</directory>
+ </fileset>
+ <fileset>
+
<directory>${project.basedir}/../resources/org/mitre/medfacts</directory>
+ </fileset>
+ <!-- Remove any old error log. -->
+ <fileset>
+ <directory>${project.basedir}/..</directory>
+ <includes>cTAKES.error.log</includes>
+ </fileset>
+ </filesets>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>