Skip to content
Permalink
Browse files
fix: keep empty output and input dirs of --draft-notebook job
  • Loading branch information
johanneskoester committed Nov 29, 2021
1 parent e92ad48 commit f1181bd41ea8b20fafd3975c2733ca1d439381dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
@@ -235,14 +235,15 @@ def update_jobids(self):
self._jobid[job] = len(self._jobid)

def cleanup_workdir(self):
for io_dir in set(
os.path.dirname(io_file)
for job in self.jobs
for io_file in chain(job.output, job.input)
if not os.path.exists(io_file)
):
if os.path.exists(io_dir) and not len(os.listdir(io_dir)):
os.removedirs(io_dir)
for job in self.jobs:
if not self.is_edit_notebook_job(job):
for io_dir, job in set(
os.path.dirname(io_file)
for io_file in chain(job.output, job.input)
if not os.path.exists(io_file)
):
if os.path.exists(io_dir) and not len(os.listdir(io_dir)):
os.removedirs(io_dir)

def cleanup(self):
self.job_cache.clear()
@@ -16,15 +16,15 @@ rule bar:
input:
infile = 'data.txt'
output:
outfile = 'result_intermediate.txt'
outfile = 'results/result_intermediate.txt'
conda:
'env.yaml'
notebook:
'Notebook.py.ipynb'

rule baz:
input:
infile = 'result_intermediate.txt'
infile = 'results/result_intermediate.txt'
output:
outfile = 'result_final.txt'
log:
@@ -37,7 +37,7 @@ rule baz:

rule wild:
input:
infile = 'result_intermediate.txt'
infile = 'results/result_intermediate.txt'
output:
outfile = '{what}.result_final.txt'
conda:
@@ -1179,7 +1179,7 @@ def test_jupyter_notebook_draft():
dpath("test_jupyter_notebook_draft"),
use_conda=True,
edit_notebook=EditMode(draft_only=True),
targets=["result_intermediate.txt"],
targets=["results/result_intermediate.txt"],
check_md5=False,
)

0 comments on commit f1181bd

Please sign in to comment.