From 96d312d41b3d703f028a9e57388c588acf08feda Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Tue, 6 Oct 2020 12:57:22 +0200 Subject: [PATCH] Fix workflows on Windows. --- Applications/Utils/ExtractBoundary.py | 8 +++++--- scripts/snakemake/vtkdiff/wrapper.py | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Applications/Utils/ExtractBoundary.py b/Applications/Utils/ExtractBoundary.py index 57dd8b36981..008b042dc0c 100644 --- a/Applications/Utils/ExtractBoundary.py +++ b/Applications/Utils/ExtractBoundary.py @@ -41,7 +41,10 @@ def extract_boundary(elem_type, inputs=[], outputs=[], @bash_app def vtk_diff(fields, inputs=[], outputs=[], stderr=parsl.AUTO_LOGNAME, stdout=parsl.AUTO_LOGNAME): + import os script = "" + if os.path.exists(outputs[0]): + os.remove(outputs[0]) for field in fields: field_a = field[0] offset = 0 @@ -51,10 +54,9 @@ def vtk_diff(fields, inputs=[], outputs=[], abs_tol = field[1 + offset] rel_tol = field[2 + offset] - script += f"""rm {outputs[0]} || true - vtkdiff {inputs[0]} {inputs[1]} \ + script += f"""vtkdiff {inputs[0]} {inputs[1]} \ -a {field_a} -b {field_b} \ - --abs {abs_tol} --rel {rel_tol} > {outputs[0]} + --abs {abs_tol} --rel {rel_tol} >> {outputs[0]} """ return script diff --git a/scripts/snakemake/vtkdiff/wrapper.py b/scripts/snakemake/vtkdiff/wrapper.py index 2347d1bc31c..013a2bed78c 100644 --- a/scripts/snakemake/vtkdiff/wrapper.py +++ b/scripts/snakemake/vtkdiff/wrapper.py @@ -7,7 +7,9 @@ __license__ = "BSD" import os from snakemake.shell import shell -output_path = os.getcwd().replace(snakemake.config['Data_BINARY_DIR'], "") +output_path = os.getcwd().replace("\\", "/").replace(snakemake.config["Data_BINARY_DIR"], "") +if os.path.exists(snakemake.output[0]): + os.remove(snakemake.output[0]) for field in snakemake.params.fields: field_a = field[0] @@ -20,10 +22,9 @@ for field in snakemake.params.fields: shell( """ - rm {snakemake.output[0]} || true vtkdiff {snakemake.input[0]} \ {snakemake.config[Data_SOURCE_DIR]}/{output_path}/{snakemake.input[0]} \ -a {field_a} -b {field_b} \ - --abs {abs_tol} --rel {rel_tol} > {snakemake.output[0]} + --abs {abs_tol} --rel {rel_tol} >> {snakemake.output[0]} """ ) -- GitLab