File tree 1 file changed +13
-11
lines changed
1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -1479,19 +1479,21 @@ def clean_working_directory(
1479
1479
needed_files = temp
1480
1480
logger .debug ("Needed files: %s" , ";" .join (needed_files ))
1481
1481
logger .debug ("Needed dirs: %s" , ";" .join (needed_dirs ))
1482
- files2remove = []
1483
1482
if str2bool (config ["execution" ]["remove_unnecessary_outputs" ]):
1484
- for f in walk_files (cwd ):
1485
- if f not in needed_files and not f .startswith (tuple (needed_dirs )):
1486
- files2remove .append (f )
1483
+ files2remove = [
1484
+ f
1485
+ for f in walk_files (cwd )
1486
+ if f not in needed_files and not f .startswith (tuple (needed_dirs ))
1487
+ ]
1488
+ elif not str2bool (config ["execution" ]["keep_inputs" ]):
1489
+ input_files = {
1490
+ path for path , type in walk_outputs (inputs .trait_get ()) if type == "f"
1491
+ }
1492
+ files2remove = [
1493
+ f for f in walk_files (cwd ) if f in input_files and f not in needed_files
1494
+ ]
1487
1495
else :
1488
- if not str2bool (config ["execution" ]["keep_inputs" ]):
1489
- input_files = {
1490
- path for path , type in walk_outputs (inputs .trait_get ()) if type == "f"
1491
- }
1492
- files2remove .extend (
1493
- f for f in walk_files (cwd ) if f in input_files and f not in needed_files
1494
- )
1496
+ files2remove = []
1495
1497
logger .debug ("Removing files: %s" , ";" .join (files2remove ))
1496
1498
for f in files2remove :
1497
1499
os .remove (f )
You can’t perform that action at this time.
0 commit comments