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();