Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Bugfix tes add files #1133

Merged
merged 8 commits into from Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions snakemake/executors/ga4gh_tes.py
Expand Up @@ -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,
Expand All @@ -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

Expand Down
16 changes: 15 additions & 1 deletion tests/test_tes.py
Expand Up @@ -23,11 +23,18 @@ def _validate_task(task):


def _post_task(request, context):
outdir = "{}/test_tes/".format(os.path.dirname(os.path.realpath(__file__)))
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
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
Expand All @@ -46,4 +53,11 @@ 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)
run(
workdir,
snakefile="Snakefile",
tes=TES_URL,
no_tmpdir=True,
cleanup=False,
forceall=True,
)
6 changes: 6 additions & 0 deletions 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"
Expand Down
Empty file.
1 change: 1 addition & 0 deletions tests/test_tes/expected-results/test_log.txt
@@ -0,0 +1 @@
log
1 change: 1 addition & 0 deletions tests/test_tes/expected-results/test_output.txt
@@ -0,0 +1 @@
output
1 change: 1 addition & 0 deletions tests/test_tes/test_input.txt
@@ -0,0 +1 @@
test