git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngine@55590 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c65adbc7f3
commit
8d4d96013c
|
@ -35,6 +35,7 @@ public class LocalSplitGenerator implements Generator {
|
|||
private SessionFactory dbHibConnection;
|
||||
private boolean stopInterrupt;
|
||||
private boolean flushInterrupt;
|
||||
private boolean forceflush;
|
||||
private SpatialProbabilityDistributionTable distributionModel;
|
||||
private int processedSpeciesCounter;
|
||||
private int spaceVectorsNumber;
|
||||
|
@ -107,6 +108,7 @@ public class LocalSplitGenerator implements Generator {
|
|||
AnalysisLogger.setLogger(config.getConfigPath() + AlgorithmConfiguration.defaultLoggerFile);
|
||||
stopInterrupt = false;
|
||||
flushInterrupt = false;
|
||||
forceflush=false;
|
||||
initDBSession();
|
||||
try {
|
||||
initModel();
|
||||
|
@ -282,7 +284,7 @@ public class LocalSplitGenerator implements Generator {
|
|||
long computationT0 = System.currentTimeMillis();
|
||||
// pre process for single species
|
||||
distributionModel.singleStepPreprocess(species, spaceVectorsNumber);
|
||||
AnalysisLogger.getLogger().trace("-> species " + distributionModel.getMainInfoID(species) + " - n. " + (processedSpeciesCounter + 1));
|
||||
AnalysisLogger.getLogger().trace("-------------------------------------------------> species " + distributionModel.getMainInfoID(species) + " - n. " + (processedSpeciesCounter + 1));
|
||||
// CALCULATION CORE
|
||||
for (int k = 0; k < numOfChunks; k++) {
|
||||
// get the starting index
|
||||
|
@ -330,6 +332,7 @@ public class LocalSplitGenerator implements Generator {
|
|||
// post process for single species
|
||||
distributionModel.singleStepPostprocess(species, spaceVectorsNumber);
|
||||
// if the process was stopped then interrupt the processing
|
||||
|
||||
if (stopInterrupt)
|
||||
break;
|
||||
}
|
||||
|
@ -415,11 +418,18 @@ public class LocalSplitGenerator implements Generator {
|
|||
|
||||
public void run() {
|
||||
try {
|
||||
if (stopInterrupt) {
|
||||
if (forceflush){
|
||||
AnalysisLogger.getLogger().trace("\t...flushing on db");
|
||||
// flush the objects
|
||||
flushBuffer();
|
||||
AnalysisLogger.getLogger().trace("\t...finished flushing on db");
|
||||
forceflush=false;
|
||||
}
|
||||
if (stopInterrupt) {
|
||||
AnalysisLogger.getLogger().trace("\t...finally flushing on db");
|
||||
// flush the objects
|
||||
flushBuffer();
|
||||
AnalysisLogger.getLogger().trace("\t...finished finally flushing on db");
|
||||
flushInterrupt = true;
|
||||
this.cancel();
|
||||
} else if ((probabilityBuffer != null) && (probabilityBuffer.size() > AlgorithmConfiguration.chunkSize)) {
|
||||
|
@ -442,7 +452,7 @@ public class LocalSplitGenerator implements Generator {
|
|||
writeOnDB(AlgorithmConfiguration.chunkSize);
|
||||
writeOnDB(probabilityBuffer.size());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void writeOnDB(int endIndex) {
|
||||
|
@ -450,7 +460,6 @@ public class LocalSplitGenerator implements Generator {
|
|||
if (endIndex > 0) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
// AnalysisLogger.getLogger().trace("writeOnDB()->PROBABILITIES BUFFER SIZE DELETION");
|
||||
for (int i = 0; i < endIndex; i++) {
|
||||
sb.append("(" + distributionModel.filterProbabiltyRow(probabilityBuffer.poll()) + ")");
|
||||
if (i < endIndex - 1) {
|
||||
|
@ -458,6 +467,7 @@ public class LocalSplitGenerator implements Generator {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
String insertionString = String.format(probabilityInsertionStatement, config.getParam("DistributionTable"), sb.toString());
|
||||
|
||||
try {
|
||||
|
|
|
@ -167,7 +167,7 @@ public class AquamapsSuitable implements SpatialProbabilityDistributionTable{
|
|||
|
||||
@Override
|
||||
public boolean isSynchronousProbabilityWrite() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@ public class PerformanceTests {
|
|||
String configPath = "./cfg/";
|
||||
String csquareTable = "hcaf_d";
|
||||
String preprocessedTable = "maxminlat_hspen";
|
||||
String envelopeTable = "hspen";
|
||||
String envelopeTable = "hspen_mini_1";
|
||||
int numberOfResources = 4;
|
||||
String speciesCode = "Fis-22747";
|
||||
String userName = "gianpaolo.coro";
|
||||
|
|
Loading…
Reference in New Issue