145 |
145 |
|
146 |
146 |
private final List<OrderHint> emptyOrderHints = new ArrayList<OrderHint>(0);
|
147 |
147 |
|
|
148 |
int byRankTicks = 300;
|
|
149 |
int byAreasTicks = 100;
|
|
150 |
|
148 |
151 |
|
149 |
152 |
/**
|
150 |
153 |
* byAreaIgnoreStatusList contains by default:
|
... | ... | |
352 |
355 |
classifications.add(classification);
|
353 |
356 |
}
|
354 |
357 |
|
355 |
|
int aggregationWorkTicks = mode.equals(AggregationMode.byAreasAndRanks) ? 400 : 200;
|
|
358 |
int aggregationWorkTicks;
|
|
359 |
switch(mode){
|
|
360 |
case byAreasAndRanks:
|
|
361 |
aggregationWorkTicks = byAreasTicks + byRankTicks;
|
|
362 |
break;
|
|
363 |
case byAreas:
|
|
364 |
aggregationWorkTicks = byAreasTicks;
|
|
365 |
break;
|
|
366 |
case byRanks:
|
|
367 |
aggregationWorkTicks = byRankTicks;
|
|
368 |
break;
|
|
369 |
default:
|
|
370 |
aggregationWorkTicks = 0;
|
|
371 |
break;
|
|
372 |
}
|
356 |
373 |
|
357 |
374 |
// take start time for performance testing
|
358 |
375 |
// NOTE: use ONLY_FISRT_BATCH = true to measure only one batch
|
359 |
376 |
double start = System.currentTimeMillis();
|
360 |
377 |
|
361 |
378 |
monitor.beginTask("Accumulating distributions", (classifications.size() * aggregationWorkTicks) + 1 );
|
|
379 |
|
362 |
380 |
updatePriorities();
|
363 |
|
monitor.worked(1);
|
364 |
381 |
|
365 |
382 |
List<Rank> ranks = rankInterval(lowerRank, upperRank);
|
366 |
383 |
|
|
384 |
monitor.worked(1);
|
|
385 |
|
|
386 |
|
367 |
387 |
for(Classification _classification : classifications) {
|
368 |
388 |
|
369 |
389 |
ClassificationLookupDTO classificationLookupDao = classificationService.classificationLookup(_classification);
|
... | ... | |
375 |
395 |
|
376 |
396 |
monitor.subTask("Accumulating distributions to super areas for " + _classification.getTitleCache());
|
377 |
397 |
if (mode.equals(AggregationMode.byAreas) || mode.equals(AggregationMode.byAreasAndRanks)) {
|
378 |
|
accumulateByArea(superAreas, classificationLookupDao, new SubProgressMonitor(monitor, 200), true);
|
|
398 |
accumulateByArea(superAreas, classificationLookupDao, new SubProgressMonitor(monitor, byAreasTicks), true);
|
379 |
399 |
}
|
380 |
400 |
monitor.subTask("Accumulating distributions to higher ranks for " + _classification.getTitleCache());
|
381 |
401 |
|
... | ... | |
384 |
404 |
|
385 |
405 |
double start3 = System.currentTimeMillis();
|
386 |
406 |
if (mode.equals(AggregationMode.byRanks) || mode.equals(AggregationMode.byAreasAndRanks)) {
|
387 |
|
accumulateByRank(ranks, classificationLookupDao, new SubProgressMonitor(monitor, 200), mode.equals(AggregationMode.byRanks));
|
|
407 |
accumulateByRank(ranks, classificationLookupDao, new SubProgressMonitor(monitor, byRankTicks), mode.equals(AggregationMode.byRanks));
|
388 |
408 |
}
|
389 |
409 |
|
390 |
410 |
double end3 = System.currentTimeMillis();
|
... | ... | |
396 |
416 |
break;
|
397 |
417 |
}
|
398 |
418 |
}
|
|
419 |
monitor.done();
|
399 |
420 |
}
|
400 |
421 |
|
401 |
422 |
|
... | ... | |
540 |
561 |
protected void accumulateByRank(List<Rank> rankInterval, ClassificationLookupDTO classificationLookupDao, IProgressMonitor subMonitor, boolean doClearDescriptions) {
|
541 |
562 |
|
542 |
563 |
int batchSize = 500;
|
|
564 |
int ticksPerRank = 100;
|
543 |
565 |
|
544 |
566 |
TransactionStatus txStatus = startTransaction(false);
|
545 |
567 |
|
... | ... | |
553 |
575 |
|
554 |
576 |
List<Rank> ranks = rankInterval;
|
555 |
577 |
|
556 |
|
int ticksPerRank = 100;
|
557 |
578 |
subMonitor.beginTask("Accumulating by rank", ranks.size() * ticksPerRank);
|
558 |
579 |
|
559 |
580 |
for (Rank rank : ranks) {
|
... | ... | |
562 |
583 |
logger.debug("accumulateByRank() - at Rank '" + termToString(rank) + "'");
|
563 |
584 |
}
|
564 |
585 |
|
565 |
|
SubProgressMonitor taxonSubMonitor = null;
|
566 |
586 |
Set<Integer> taxonIdsPerRank = classificationLookupDao.getTaxonIdByRank().get(rank);
|
567 |
|
if(taxonIdsPerRank == null || taxonIdsPerRank.isEmpty()) {
|
|
587 |
|
|
588 |
int taxonCountperRank = taxonIdsPerRank != null ? taxonIdsPerRank.size() : 0;
|
|
589 |
|
|
590 |
SubProgressMonitor taxonSubMonitor = new SubProgressMonitor(subMonitor, ticksPerRank);
|
|
591 |
taxonSubMonitor.beginTask("Accumulating by rank " + termToString(rank), taxonCountperRank);
|
|
592 |
|
|
593 |
if(taxonCountperRank == 0) {
|
|
594 |
taxonSubMonitor.done();
|
568 |
595 |
continue;
|
569 |
596 |
}
|
|
597 |
|
|
598 |
|
570 |
599 |
Iterator<Integer> taxonIdIterator = taxonIdsPerRank.iterator();
|
571 |
600 |
while (taxonIdIterator.hasNext()) {
|
572 |
601 |
|
... | ... | |
583 |
612 |
|
584 |
613 |
taxa = taxonService.loadByIds(taxonIds, null);
|
585 |
614 |
|
586 |
|
if(taxonSubMonitor == null) {
|
587 |
|
taxonSubMonitor = new SubProgressMonitor(subMonitor, ticksPerRank);
|
588 |
|
taxonSubMonitor.beginTask("Accumulating by rank " + termToString(rank), taxa.size());
|
589 |
|
}
|
590 |
|
|
591 |
615 |
// if(logger.isDebugEnabled()){
|
592 |
616 |
// logger.debug("accumulateByRank() - taxon " + taxonPager.getFirstRecord() + " to " + taxonPager.getLastRecord() + " of " + taxonPager.getCount() + "]");
|
593 |
617 |
// }
|
... | ... | |
671 |
695 |
}
|
672 |
696 |
} // next batch
|
673 |
697 |
|
674 |
|
if(taxonSubMonitor != null) { // TODO taxonSubpager, this check should not be needed
|
675 |
|
taxonSubMonitor.done();
|
676 |
|
}
|
|
698 |
taxonSubMonitor.done();
|
677 |
699 |
subMonitor.worked(1);
|
678 |
700 |
|
679 |
701 |
if(ONLY_FISRT_BATCH) {
|
... | ... | |
681 |
703 |
}
|
682 |
704 |
} // next Rank
|
683 |
705 |
|
|
706 |
logger.info("accumulateByRank() - done");
|
684 |
707 |
subMonitor.done();
|
685 |
708 |
}
|
686 |
709 |
|
#5191 fixing process monitor updating in TransmissionEngine
this is most probably not fixing the ticket but helps providing more reliable monitoring