Gianpaolo Coro 2015-09-01 12:05:51 +00:00
parent e308cdd888
commit f35dd3fb44
1 changed files with 22 additions and 7 deletions

View File

@ -130,15 +130,17 @@ public class ICCATVPA extends ActorNode {
@Override @Override
public StatisticalType getOutput() { public StatisticalType getOutput() {
File outfile = new File(config.getPersistencePath(),processOutput); //File outfile = new File(config.getPersistencePath(),processOutput);
File outfile = new File(processOutput);
LinkedHashMap<String, StatisticalType> outputmap = new LinkedHashMap<String, StatisticalType>(); LinkedHashMap<String, StatisticalType> outputmap = new LinkedHashMap<String, StatisticalType>();
if (outfile.exists())
AnalysisLogger.getLogger().debug("ICCAT-VPA Output: "+outfile.getAbsolutePath()+" : "+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");
PrimitiveType o = new PrimitiveType(File.class.getName(), outfile, PrimitiveTypes.FILE, "ProcessedSpecies", "Output file with processed species"); 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, "ProcessSummary", "Output file containing the process summary");
outputmap.put("Zip file containing the process output", o); outputmap.put("Zip file containing the process output", o);
PrimitiveType output = new PrimitiveType(HashMap.class.getName(), outputmap, PrimitiveTypes.MAP, "Results File", "Results File"); 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); AnalysisLogger.getLogger().debug("ICCAT-VPA - Downloading file "+processOutput);
StorageUtils.downloadFilefromStorage(config.getGcubeScope(), config.getParam("ServiceUserName"), config.getPersistencePath(), 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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();