From f35dd3fb440d628368978b45af2864ec122ca685 Mon Sep 17 00:00:00 2001 From: Gianpaolo Coro Date: Tue, 1 Sep 2015 12:05:51 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineSmartExecutor@117754 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../executor/nodes/algorithms/ICCATVPA.java | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/gcube/dataanalysis/executor/nodes/algorithms/ICCATVPA.java b/src/main/java/org/gcube/dataanalysis/executor/nodes/algorithms/ICCATVPA.java index cff3d87..466e24c 100644 --- a/src/main/java/org/gcube/dataanalysis/executor/nodes/algorithms/ICCATVPA.java +++ b/src/main/java/org/gcube/dataanalysis/executor/nodes/algorithms/ICCATVPA.java @@ -130,15 +130,17 @@ public class ICCATVPA extends ActorNode { @Override public StatisticalType getOutput() { - File outfile = new File(config.getPersistencePath(),processOutput); + //File outfile = new File(config.getPersistencePath(),processOutput); + File outfile = new File(processOutput); LinkedHashMap outputmap = new LinkedHashMap(); + AnalysisLogger.getLogger().debug("ICCAT-VPA Output: "+outfile.getAbsolutePath()+" : "+outfile.exists()); - if (outfile.exists()) - AnalysisLogger.getLogger().debug("ICCAT-VPA Output: "+outfile.getAbsolutePath()+" : "+outfile.exists()); - else - AnalysisLogger.getLogger().debug("ICCAT-VPA Output file does not exist - returning a proxy"); + if (!outfile.exists()){ + AnalysisLogger.getLogger().debug("ICCAT-VPA Output file "+processOutput+" does not exist - returning null "); + return null; + } - PrimitiveType o = new PrimitiveType(File.class.getName(), outfile, PrimitiveTypes.FILE, "ProcessedSpecies", "Output file with processed species"); + PrimitiveType o = new PrimitiveType(File.class.getName(), outfile, PrimitiveTypes.FILE, "ProcessSummary", "Output file containing the process summary"); outputmap.put("Zip file containing the process output", o); PrimitiveType output = new PrimitiveType(HashMap.class.getName(), outputmap, PrimitiveTypes.MAP, "Results File", "Results File"); @@ -267,7 +269,20 @@ public class ICCATVPA extends ActorNode { AnalysisLogger.getLogger().debug("ICCAT-VPA - Downloading file "+processOutput); StorageUtils.downloadFilefromStorage(config.getGcubeScope(), config.getParam("ServiceUserName"), config.getPersistencePath(), processOutput); - AnalysisLogger.getLogger().debug("ICCAT-VPA - Postprocess complete: output ready in "+processOutput); + File of = new File(config.getPersistencePath(),processOutput); + for (int i=0;i<3;i++){ + if (of.exists()) + break; + else + Thread.sleep(1000); + } + + if (of.exists()){ + AnalysisLogger.getLogger().debug("ICCAT-VPA - Postprocess complete: output ready in "+of.getAbsolutePath()); + processOutput=of.getAbsolutePath(); + } + else + AnalysisLogger.getLogger().debug("ICCAT-VPA - Warning Postprocess error - output does not exist ! "+of.getAbsolutePath()); } catch (Exception e) { e.printStackTrace();