-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Aggregate CAS Multiplier #25
base: main
Are you sure you want to change the base?
Conversation
TODO: Documentation and exception handling
No longer have to cast FlowController to FixedFlowController when we want to find an engine
Also introduced new Exception: EngineProcessingException
FlowController is not deleted on destruction
The constructor for the UNSPECIFIED case didn't initialize the union properly, so when SimpleStep's assignment operator is called later on it can segfault when assigning string.
The union needed to be properly destroyed in assignment operator, and initialized in copy constructor and AO
This introduces a new error ID and error message UIMA_MSG_ID_EXC_INVALID_CAS_RELEASE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annotator_mgr diff is very big and full of whitespace changes. Please remove all the whitespace changes from this diff in all files, especially in annotator_mgr so I can finish the review.
src/test/src/test_engine.cpp
Outdated
@@ -635,9 +636,9 @@ void mainTest(uima::util::ConsoleUI & rclConsole, | |||
testCallingSequence2(rclConsole, cpszConfigFilename); | |||
testCallingSequence3(rclConsole, cpszConfigFilename); | |||
} | |||
testCasMultiplier(rclConsole); | |||
testCasMultiplier(rclConsole); testAggregateCASMultiplier(rclConsole); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ran it three times?
@@ -64,6 +64,10 @@ namespace uima { | |||
/* Types / Classes */ | |||
/* ----------------------------------------------------------------------- */ | |||
namespace uima { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there's no other exception already defined by the framework that we could use? The framework already declares other 80 exceptions:
uima-uimacpp/src$ find . -name \*.hpp -exec grep -H UIMA_EXC_CLASSDECLARE \{} \;
./cas/uima/featurestructure.hpp: UIMA_EXC_CLASSDECLARE(InvalidFSObjectException, CASException);
./cas/uima/featurestructure.hpp: UIMA_EXC_CLASSDECLARE(FeatureNotAppropriateException, CASException);
./cas/uima/featurestructure.hpp: UIMA_EXC_CLASSDECLARE(IncompatibleValueTypeException, CASException);
./cas/uima/featurestructure.hpp: UIMA_EXC_CLASSDECLARE(FSIsNotStringException, CASException);
./cas/uima/featurestructure.hpp: UIMA_EXC_CLASSDECLARE(WrongStringValueException, CASException);
./cas/uima/arrayfs.hpp: UIMA_EXC_CLASSDECLARE(FSIsNotArrayException, CASException);
./cas/uima/arrayfs.hpp: UIMA_EXC_CLASSDECLARE(FSArrayOutOfBoundsException, CASException);
./cas/uima/fsindexrepository.hpp: UIMA_EXC_CLASSDECLARE(InvalidIndexIDException, CASException);
./cas/uima/typesystem.hpp: UIMA_EXC_CLASSDECLARE(TypeSystemAlreadyCommittedException, CASException);
./cas/uima/typesystem.hpp: UIMA_EXC_CLASSDECLARE(InvalidFSFeatureObjectException, CASException);
./cas/uima/typesystem.hpp: UIMA_EXC_CLASSDECLARE(InvalidFSTypeObjectException, CASException);
./cas/uima/casexception.hpp: UIMA_EXC_CLASSDECLARE(CASException, Exception);
./cas/uima/casexception.hpp: UIMA_EXC_CLASSDECLARE(NotYetImplementedException, CASException);
./cas/uima/casexception.hpp: UIMA_EXC_CLASSDECLARE(SofaDataStreamException, CASException);
./cas/uima/cas.hpp: UIMA_EXC_CLASSDECLARE(CouldNotCreateFSOfFinalTypeException, CASException);
./cas/uima/cas.hpp: UIMA_EXC_CLASSDECLARE(DuplicateSofaNameException, CASException);
./cas/uima/cas.hpp: UIMA_EXC_CLASSDECLARE(InvalidBaseCasMethod, CASException);
./cas/uima/xmltypesystemreader.hpp: UIMA_EXC_CLASSDECLARE(XMLTypeSystemReaderException, uima::Exception);
./cas/uima/lowlevel_typesystem.hpp: UIMA_EXC_CLASSDECLARE(FeatureIntroductionFailedException, CASException);
./cas/uima/lowlevel_typesystem.hpp: UIMA_EXC_CLASSDECLARE(TypeCreationFailedException, CASException);
./cas/uima/fsindex.hpp: UIMA_EXC_CLASSDECLARE(InvalidIndexObjectException, CASException);
./cas/uima/fsindex.hpp: UIMA_EXC_CLASSDECLARE(WrongFSTypeForIndexException, CASException);
./cas/uima/listfs.hpp: UIMA_EXC_CLASSDECLARE(FSIsNotListException, CASException);
./cas/uima/listfs.hpp: UIMA_EXC_CLASSDECLARE(ListIsEmptyException, CASException);
./cas/uima/listfs.hpp: UIMA_EXC_CLASSDECLARE(ListIsCircularException, CASException);
./cas/uima/internal_casdeserializer.hpp: UIMA_EXC_CLASSDECLARE(DeserializationException, Exception);
./framework/uima/exceptions.hpp: UIMA_EXCEPTION_DESCRIPTION, UIMA_EXC_CLASSDECLARE, UIMA_EXC_CLASSIMPLEMENT,
./framework/uima/exceptions.hpp: <TT>UIMA_EXC_CLASSDECLARE</TT> in an .h/.hpp file there must be one use of
./framework/uima/exceptions.hpp:#define UIMA_EXC_CLASSDECLARE(child,parent) \
./framework/uima/exceptions.hpp: <TT>UIMA_EXC_CLASSDECLARE</TT> (see above) in the corresponding .h/.hpp file
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_logic_error, Exception);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_runtime_error, Exception);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_domain_error, Uima_logic_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_invalid_argument, Uima_logic_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_length_error, Uima_logic_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_out_of_range, Uima_logic_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_range_error, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_overflow_error, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(Uima_underflow_error, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ConsoleAbortExc, Exception);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcDocBuffer, Uima_out_of_range);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ParseHandlerExc, Exception);
./framework/uima/exceptions.hpp://? UIMA_EXC_CLASSDECLARE(ExcAccessError, Uima_runtime_error);
./framework/uima/exceptions.hpp://? UIMA_EXC_CLASSDECLARE(ExcAssertionFailure, Exception);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcIllFormedInputError, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcInvalidParameter, Uima_invalid_argument);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcIndexOutOfRange, Uima_out_of_range);
./framework/uima/exceptions.hpp://? UIMA_EXC_CLASSDECLARE(ExcDeviceError, _runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcInvalidRequest, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcResourceExhausted, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcOutOfMemory, ExcResourceExhausted);
./framework/uima/exceptions.hpp://? UIMA_EXC_CLASSDECLARE(ExcOutOfSystemResource, ResourceExhausted);
./framework/uima/exceptions.hpp://? UIMA_EXC_CLASSDECLARE(ExcOutOfWindowResource, ResourceExhausted);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcFileNotFoundError, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(ExcWinCException, Uima_runtime_error);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(CodePageConversionException, Exception);
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(AprFailureException, Exception);
./framework/uima/exceptions.hpp: To declare a new exception class, use the <TT>UIMA_EXC_CLASSDECLARE</TT> macro in an .h/.hpp
./framework/uima/exceptions.hpp: UIMA_EXC_CLASSDECLARE(AnnotatorException, InvalidRequest);
./framework/uima/casiterator.hpp: UIMA_EXC_CLASSDECLARE(CASIteratorException, uima::Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(UnknownTypeException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(UnknownFeatureException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(UnknownRangeTypeException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(IncompatibleRangeTypeException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(AllowedStringValuesIncompatibleException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(TypePriorityConflictException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(IncompatibleIndexDefinitionsException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(IncompatibleParentTypesException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(CASIncompatibilityException, Exception);
./framework/uima/engine.hpp: UIMA_EXC_CLASSDECLARE(UimaAnalysisComponentException, Exception);
./framework/uima/internal_jedii_engine.hpp: UIMA_EXC_CLASSDECLARE(JavaException, Exception);
./framework/uima/internal_capability_container.hpp: UIMA_EXC_CLASSDECLARE(CapabilityException, Exception);
./framework/uima/taespecifierbuilder.hpp: UIMA_EXC_CLASSDECLARE(InvalidXMLException, uima::Exception);
./framework/uima/caspool.hpp: UIMA_EXC_CLASSDECLARE(CASPoolException, uima::Exception);
./framework/uima/taespecifier.hpp: UIMA_EXC_CLASSDECLARE(ConfigParamLookupException, ConfigException);
./framework/uima/taemetadata.hpp: UIMA_EXC_CLASSDECLARE(DuplicateConfigElemException, uima::Exception);
./framework/uima/taemetadata.hpp: UIMA_EXC_CLASSDECLARE(ValidationException, uima::Exception);
./framework/uima/annotator.hpp: UIMA_EXC_CLASSDECLARE(ExcEnumerationOverflow, ExcIllFormedInputError);
./framework/uima/config_param.hpp: UIMA_EXC_CLASSDECLARE(ConfigException, Exception);
./framework/uima/config_param.hpp: UIMA_EXC_CLASSDECLARE(ConfigParamException, ConfigException);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you say UimaAnalysisComponentException is appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a few questions and comments but overall I managed to go through the whole thing this time.
I'll now proceed to stress test it a bit.
@@ -77,12 +77,12 @@ | |||
</array> | |||
</value> | |||
</nameValuePair> | |||
<nameValuePair> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like something didn't need to be committed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This override would fail the test case for the newer override spec. Do you want me to keep it for now and deal with the test case later, or just remove that portion?
return nullptr; | ||
} | ||
|
||
if (iv_bOutputNewCases && !finalStep->getForceDropCAS()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check I'm understanding the code correctly, this is where the DROP_IF_NEW_CAS_PRODUCED
functionality is implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the finalStep will determine if that CAS is dropped or not. In this instance that finalStep is constructed by the FixedFlowController and FixedFlowObject, and the default action in the FixedFlowController is DROP_IF_NEW_CAS_PRODUCED
if (!result) | ||
result = processUntilNextOutputCas(); | ||
if (!result) { | ||
UIMA_EXC_THROW_NEW(Exception, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this call also release()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No when it is returned to the caller/user they will call release
themselves. Or do you mean something else?
What's in the PR
FlowController
and its child classFixedFlowController
[1]. Custom Flow Controllers and Flow Controller descriptor files are not yet added.Step
class andFlow
interface [2].CAS::release
method to allow the CAS to release itself, similar to the Java API [3].AnnotatorContext
owner.Tests
The first test case added in #22 is now passing. The second test case should still be revised, as outlined in #24
Edit: #24 is now covered after the latest commit.