[
https://issues.apache.org/jira/browse/UIMA-5812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16541820#comment-16541820
]
Marshall Schor commented on UIMA-5812:
--------------------------------------
Looking at the implementation in CPMEngine of getCasProcessors(), it seems to
have 2 implementations, plus a memoization which guarantees that whatever it
returns at the "first" call, it will return the same result from then on.
# if not yet deployed, returns a list (maybe in arbitrary order) of all AE's
and CC's, maybe intermingled.
# if deployed, returns a list of
## all AE's (in arbitrary order)
## all CC's (but also including AE's which are not parallelizable) (in
arbitrary order)
This Jira would change the ordering, but only in the "deployed" case, to be the
order in the
# annotatorDeployList and then
# consumerDeployList
These lists, themselves, have an order which appears to be somewhat arbitrary.
They are built when deployment occurs, and are in reverse order to what the
not-yet-deployed use-case-call might have returned, with some differences due
to the annotators coming ahead of the consumers, except for annotators which
can't be run in parallel, which are moved to the consumer list.
Because of all of this variability, it seems unlikely that the order means much
to the callers. It looks like the callers within UIMA itself do not depend on
the order.
Is there a use case you have where the order matters, and if so, can you please
describe that, and what the order needs to be to satisfy that use case?
> CPMEngine's getCasProcessors() messes up the ae engines order
> -------------------------------------------------------------
>
> Key: UIMA-5812
> URL: https://issues.apache.org/jira/browse/UIMA-5812
> Project: UIMA
> Issue Type: Bug
> Components: UIMA
> Affects Versions: 2.10.0SDK, 2.10.2SDK, 3.0.0SDK, 2.10.3SDK
> Environment: Ubuntu18.04, Java(TM) SE Runtime Environment (build
> 1.8.0_151-b12)
> Reporter: Jianlin Shi
> Priority: Major
>
> In the current code:
> {quote} ArrayList aList = new ArrayList();
> Iterator keyIt = analysisEngines.keySet().iterator();
> while (keyIt.hasNext()) {
> String keyName = (String) keyIt.next();
> List kList = (List) analysisEngines.get(keyName);
> if (kList != null) {
> for (int i = 0; i < kList.size(); i++) {
> aList.add(kList.get(i));
> }
> }
> }
> keyIt = consumers.keySet().iterator();
> while (keyIt.hasNext()) {
> String keyName = (String) keyIt.next();
> List kList = (List) consumers.get(keyName);
> if (kList != null) {
> for (int i = 0; i < kList.size(); i++) {
> aList.add(kList.get(i));
> }
> }
> }
> {quote}
> While analysisEngines and consumers are both Hashtables, iterating through
> the keys won't preserve the order.
> Suggest to use the following instead:
> {quote} ArrayList aList = new ArrayList();
> for(Object annotator:this.annotatorDeployList){
> List kList = (List) annotator;
> if (kList != null) {
> for (int i = 0; i < kList.size(); i++) {
> aList.add(kList.get(i));
> }
> }
> }
> for(Object annotator:this.consumerDeployList){
> List kList = (List) annotator;
> if (kList != null) {
> for (int i = 0; i < kList.size(); i++) {
> aList.add(kList.get(i));
> }
> }
> }
> {quote}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)