diff --git a/snakemake/executors/ga4gh_tes.py b/snakemake/executors/ga4gh_tes.py index 5675ee400..09c445969 100644 --- a/snakemake/executors/ga4gh_tes.py +++ b/snakemake/executors/ga4gh_tes.py @@ -315,7 +315,7 @@ def _get_task_inputs(self, job, jobscript, checkdir): return inputs - def _append_task_outputs(self, outputs, files): + def _append_task_outputs(self, outputs, files, checkdir): for file in files: obj = self._prepare_file( filename=file, @@ -329,15 +329,15 @@ def _append_task_outputs(self, outputs, files): def _get_task_outputs(self, job, checkdir): outputs = [] # add output files to outputs - outputs = self._append_task_outputs(outputs, job.output) + outputs = self._append_task_outputs(outputs, job.output, checkdir) # add log files to outputs if job.log: - outputs = self._append_task_outputs(outputs, job.log) + outputs = self._append_task_outputs(outputs, job.log, checkdir) # add benchmark files to outputs if hasattr(job, "benchmark") and job.benchmark: - outputs = self._append_task_outputs(outputs, job.benchmark) + outputs = self._append_task_outputs(outputs, job.benchmark, checkdir) return outputs diff --git a/tests/test_tes.py b/tests/test_tes.py index cb4d96c39..23a665d2a 100644 --- a/tests/test_tes.py +++ b/tests/test_tes.py @@ -23,11 +23,19 @@ def _validate_task(task): def _post_task(request, context): + outdir = dpath("test_tes") print("\n>>>> _post_task", file=sys.stderr) task = json.loads(request.body) print(task, file=sys.stderr) if _validate_task(task): context.status_code = 200 + # create output file + print("\n create output files in {}".format(outdir), file=sys.stderr) + with open("{}/test_output.txt".format(outdir), "w+") as f: + f.write("output") + # create log file + with open("{}/test_log.txt".format(outdir), "w+") as f: + f.write("log") return TEST_POST_RESPONSE else: context.status_code = 400 @@ -46,4 +54,12 @@ def test_tes(requests_mock): "GET", "{}/v1/tasks/id_1".format(TES_URL), json=_get_task ) workdir = dpath("test_tes") - run(workdir, snakefile="Snakefile", tes=TES_URL, no_tmpdir=True, cleanup=False) + print("\n>>>> run workflow in {}".format(workdir), file=sys.stderr) + run( + workdir, + snakefile="Snakefile", + tes=TES_URL, + no_tmpdir=True, + cleanup=False, + forceall=True, + ) diff --git a/tests/test_tes/Snakefile b/tests/test_tes/Snakefile index 1c758eef1..4e01ad90d 100644 --- a/tests/test_tes/Snakefile +++ b/tests/test_tes/Snakefile @@ -1,5 +1,11 @@ rule all: + input: + "test_input.txt" + output: + "test_output.txt" + log: + "test_log.txt" shell: """ echo "task submitted to tes" diff --git a/tests/test_tes/test_input.txt b/tests/test_tes/test_input.txt new file mode 100644 index 000000000..30d74d258 --- /dev/null +++ b/tests/test_tes/test_input.txt @@ -0,0 +1 @@ +test \ No newline at end of file