File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 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(
14791479 needed_files = temp
14801480 logger .debug ("Needed files: %s" , ";" .join (needed_files ))
14811481 logger .debug ("Needed dirs: %s" , ";" .join (needed_dirs ))
1482- files2remove = []
14831482 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+ ]
14871495 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 = []
14951497 logger .debug ("Removing files: %s" , ";" .join (files2remove ))
14961498 for f in files2remove :
14971499 os .remove (f )
You can’t perform that action at this time.
0 commit comments