Snakemake version
5.14.0
Describe the bug
Snakemake does not exit gracefully if the output filename is an empty string
Logs
$ snakemake -j1 archive
Building DAG of jobs...
Using shell: /usr/bin/bash
Provided cores: 12
Rules claiming more threads will be scaled down.
Job counts:
count jobs
1 archive
1
[Tue Apr 21 04:13:50 2020]
rule archive:
output:
jobid: 0
Traceback (most recent call last):
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/__init__.py", line 633, in snakemake
keepincomplete=keep_incomplete,
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/workflow.py", line 850, in execute
success = scheduler.schedule()
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/scheduler.py", line 374, in schedule
self.run(job)
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/scheduler.py", line 393, in run
error_callback=self._error,
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/executors.py", line 356, in run
super()._run(job)
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/executors.py", line 178, in _run
self.register_job(job)
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/executors.py", line 171, in register_job
job.register()
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/jobs.py", line 938, in register
self.dag.workflow.persistence.started(self)
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/persistence.py", line 161, in started
f,
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/persistence.py", line 304, in _record
recpath = self._record_path(subject, id)
File "/home/avmo/.conda/envs/eturb/lib/python3.7/site-packages/snakemake/persistence.py", line 362, in _record_path
b64id = ["@" + s for s in b64id[:-1]] + [b64id[-1]]
IndexError: list index out of range
Minimal example
import os
def file_name_generator(base):
if os.path.exists(base):
return "my_file.tar"
else:
return ""
rule clean:
params:
tarball = file_name_generator("source.txt")
shell:
"""
if [ "{params.tarball}" ] && [ ! -f "{params.tarball}" ]; then
echo "ERROR: Archive {params.tarball} not found. Refusing to clean simulation files! Run 'snakemake archive'"
exit 1
fi
rm -f source.txt
"""
rule archive:
params: msg = "Hello"
output: file_name_generator("source.txt")
shell: "tar -cf {output} source.txt"
Additional context
Both rules execute if source.txt is present. I used the empty string as a placeholder, when source.txt is missing which triggered this error message.
Snakemake version
5.14.0
Describe the bug
Snakemake does not exit gracefully if the output filename is an empty string
Logs
Minimal example
Additional context
Both rules execute if
source.txtis present. I used the empty string as a placeholder, whensource.txtis missing which triggered this error message.