Skip to content

Commit

Permalink
create directories not only for datasets subdirs
Browse files Browse the repository at this point in the history
  • Loading branch information
denisri committed Oct 4, 2023
1 parent 02acd7c commit 5c157ff
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions capsul/execution_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,27 +215,25 @@ def __init__(self, executable, create_output_dirs=True, priority=None,
if isinstance(value, (list, tuple)):
todo += value
elif isinstance(value, str):
if value.startswith('!{dataset.') \
and value.find('}') >= 11:
dpath = os.path.dirname(value)
# remove redundant paths (parents of others)
dpathf = os.path.join(dpath, '')
do_add = True
to_remove = []
for p in out_dirs:
if p.startswith(dpathf):
# already a deeper one present
do_add = False
break
if dpath.startswith(os.path.join(p, '')):
# current is deeper
to_remove.append(p)
for p in to_remove:
out_dirs.remove(p)
if do_add:
out_dirs.add(dpath)
# anyway make a dependency of job over dir_job
add_dep = True
dpath = os.path.dirname(value)
# remove redundant paths (parents of others)
dpathf = os.path.join(dpath, '')
do_add = True
to_remove = []
for p in out_dirs:
if p.startswith(dpathf):
# already a deeper one present
do_add = False
break
if dpath.startswith(os.path.join(p, '')):
# current is deeper
to_remove.append(p)
for p in to_remove:
out_dirs.remove(p)
if do_add:
out_dirs.add(dpath)
# anyway make a dependency of job over dir_job
add_dep = True
if add_dep:
out_deps.append(job_id)
if out_job_id is None:
Expand Down

0 comments on commit 5c157ff

Please sign in to comment.