From e81652eb486768e3b57fbf08ed6678e9fa2653d4 Mon Sep 17 00:00:00 2001 From: Mario Frank Date: Wed, 29 Jul 2026 14:42:03 +0200 Subject: [PATCH 1/4] Expose the functionality to suppress the creation of non-executable CWL and snakemake files. --- .../nl/esciencecenter/restape/ApeAPI.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/java/nl/esciencecenter/restape/ApeAPI.java b/src/main/java/nl/esciencecenter/restape/ApeAPI.java index 14ac833..ce5abae 100644 --- a/src/main/java/nl/esciencecenter/restape/ApeAPI.java +++ b/src/main/java/nl/esciencecenter/restape/ApeAPI.java @@ -246,11 +246,27 @@ public static List runSynthesis(JSONObject configJson, bool // Define the synthesis run ID String runID = RestApeUtils.generateRunID(configJson.toString()); - SolutionsList candidateSolutions = executeSynthesis(configJson, runID); + String solutionPath = RestApeUtils.createDirectory(runID); + + APE apeFramework = new APE(configJson); + + APERunConfig runConfig = new APERunConfig(configJson, apeFramework.getDomainSetup()); + + runConfig.setSolutionPath(solutionPath); + int maxSol = runConfig.getMaxNoSolutions(); + runConfig.setNoCWL(maxSol); + runConfig.setNoSnakemake(maxSol); + runConfig.setNoGraphs(maxSol); + runConfig.setDebugMode(true); + + bool createPartialScripts = runConfig.getCreatePartialScripts(); + + // run the synthesis and retrieve the solutions + SolutionsList candidateSolutions = apeFramework.runSynthesis(runConfig); // Write solutions (as CWL and Snakemake files and figures) to the file system. - APE.writeCWLWorkflows(candidateSolutions, true); - APE.writeSnakemakeWorkflows(candidateSolutions, true); + APE.writeCWLWorkflows(candidateSolutions, createPartialScripts); + APE.writeSnakemakeWorkflows(candidateSolutions, createPartialScripts); APE.writeTavernaDesignGraphs(candidateSolutions, Format.SVG); APE.writeTavernaDesignGraphs(candidateSolutions, Format.PNG); From 6e53bf81f90f944ecdc1ae59dc927f148ebc6a9b Mon Sep 17 00:00:00 2001 From: Mario Frank Date: Wed, 29 Jul 2026 14:55:06 +0200 Subject: [PATCH 2/4] Fixing typo --- src/main/java/nl/esciencecenter/restape/ApeAPI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/nl/esciencecenter/restape/ApeAPI.java b/src/main/java/nl/esciencecenter/restape/ApeAPI.java index ce5abae..2e0a90f 100644 --- a/src/main/java/nl/esciencecenter/restape/ApeAPI.java +++ b/src/main/java/nl/esciencecenter/restape/ApeAPI.java @@ -259,7 +259,7 @@ public static List runSynthesis(JSONObject configJson, bool runConfig.setNoGraphs(maxSol); runConfig.setDebugMode(true); - bool createPartialScripts = runConfig.getCreatePartialScripts(); + boolean createPartialScripts = runConfig.getCreatePartialScripts(); // run the synthesis and retrieve the solutions SolutionsList candidateSolutions = apeFramework.runSynthesis(runConfig); From b7598897788f9d1030329bc678310381d03ec611 Mon Sep 17 00:00:00 2001 From: Mario Frank Date: Wed, 29 Jul 2026 15:48:10 +0200 Subject: [PATCH 3/4] Leave CWL and SMK file name in metadata empty, if the files were not generated. Also, check during ZIP creation whether the files do exist and ignore them, if not. --- .../controller/dto/WorkflowsZip.java | 18 ++++++++++--- .../restape/APEWorkflowMetadata.java | 26 ++++++++++++++++--- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/src/main/java/nl/esciencecenter/controller/dto/WorkflowsZip.java b/src/main/java/nl/esciencecenter/controller/dto/WorkflowsZip.java index 97e7988..2ad9107 100644 --- a/src/main/java/nl/esciencecenter/controller/dto/WorkflowsZip.java +++ b/src/main/java/nl/esciencecenter/controller/dto/WorkflowsZip.java @@ -1,5 +1,6 @@ package nl.esciencecenter.controller.dto; +import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; @@ -82,15 +83,24 @@ public List getSnakemakePaths() { } /** - * Get the paths to the CWL, Snakemake and the SVG files. + * Get the paths to the existing CWL, Snakemake and the SVG files. * - * @return List of paths to the CWL, Snakemake and the SVG files. + * @return List of paths to the existing CWL, Snakemake and the SVG files. */ public List getAllPaths() { List paths = new ArrayList<>(); for (String fileName : workflows) { - paths.add(RestApeUtils.calculatePath(runID, "CWL", fileName)); - paths.add(RestApeUtils.calculatePath(runID, "Snakemake", fileName.replace(".cwl", ".smk"))); + + Path cwlPath = RestApeUtils.calculatePath(runID, "CWL", fileName); + if(Files.exists(cwlPath)) { + paths.add(cwlPath); + } + + Path smkPath = RestApeUtils.calculatePath(runID, "Snakemake", fileName.replace(".cwl", ".smk")); + if(Files.exists(smkPath)) { + paths.add(smkPath); + } + paths.add(RestApeUtils.calculatePath(runID, "Figures", fileName.replace(".cwl", ".svg"))); } return paths; diff --git a/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java b/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java index 240ae9d..4c0eeab 100644 --- a/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java +++ b/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java @@ -8,6 +8,9 @@ import lombok.NoArgsConstructor; import nl.uu.cs.ape.solver.solutionStructure.SolutionWorkflow; +import java.nio.file.Files; +import java.nio.file.Path; + /** * The {@link APEWorkflowMetadata} class represents metadata for a workflow solution from the APE solver. * This class encapsulates the details and metadata of a workflow solution, @@ -50,11 +53,26 @@ public APEWorkflowMetadata(SolutionWorkflow sol, String runID, boolean benchmark this.description = sol.getDescription(); this.workflowLength = sol.getSolutionLength(); this.runId = runID; - this.cwlName = sol.getFileName() + ".cwl"; - this.snakemakeName = sol.getFileName() + ".smk"; - this.figureName = sol.getFileName(); + + String fileName = sol.getFileName(); + + Path cwlPath = RestApeUtils.calculatePath(runID, "CWL", fileName); + if(Files.notExists(cwlPath)) { + this.cwlName = ""; + } else { + this.cwlName = fileName + ".cwl"; + } + + Path smkPath = RestApeUtils.calculatePath(runID, "Snakemake", fileName); + if(Files.notExists(smkPath)) { + this.snakemakeName = ""; + } else { + this.snakemakeName = fileName + ".smk"; + } + + this.figureName = fileName; if (benchmark) { - this.benchmarkFile = sol.getFileName() + ".json"; + this.benchmarkFile = fileName + ".json"; } } From e8230d0379916525dae37c098192915a19045b47 Mon Sep 17 00:00:00 2001 From: Mario Frank Date: Wed, 29 Jul 2026 16:44:06 +0200 Subject: [PATCH 4/4] Fix metadata creation --- .../java/nl/esciencecenter/restape/APEWorkflowMetadata.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java b/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java index 4c0eeab..8c89c70 100644 --- a/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java +++ b/src/main/java/nl/esciencecenter/restape/APEWorkflowMetadata.java @@ -56,14 +56,14 @@ public APEWorkflowMetadata(SolutionWorkflow sol, String runID, boolean benchmark String fileName = sol.getFileName(); - Path cwlPath = RestApeUtils.calculatePath(runID, "CWL", fileName); + Path cwlPath = RestApeUtils.calculatePath(runID, "CWL", fileName + ".cwl"); if(Files.notExists(cwlPath)) { this.cwlName = ""; } else { this.cwlName = fileName + ".cwl"; } - Path smkPath = RestApeUtils.calculatePath(runID, "Snakemake", fileName); + Path smkPath = RestApeUtils.calculatePath(runID, "Snakemake", fileName + ".smk"); if(Files.notExists(smkPath)) { this.snakemakeName = ""; } else {