diff --git a/src/radical/pilot/agent/staging_input/default.py b/src/radical/pilot/agent/staging_input/default.py index deb98bf64..3384378b7 100644 --- a/src/radical/pilot/agent/staging_input/default.py +++ b/src/radical/pilot/agent/staging_input/default.py @@ -181,8 +181,7 @@ def _handle_task(self, task, actionables): if action in [rpc.COPY, rpc.LINK, rpc.MOVE]: assert src.schema == 'file', 'staging src expected as file://' - # backend will take care of dir creation - but we do it manually - # for local ops (copy, link, move) + # implicitly create target dir if needed - but only for local ops if action != rpc.TRANSFER: tgtdir = os.path.dirname(tgt.path) if tgtdir != task_sandbox.path: diff --git a/src/radical/pilot/agent/staging_output/default.py b/src/radical/pilot/agent/staging_output/default.py index 3bd98285e..b10e70c7b 100644 --- a/src/radical/pilot/agent/staging_output/default.py +++ b/src/radical/pilot/agent/staging_output/default.py @@ -317,6 +317,13 @@ def _handle_task_staging(self, task, actionables): if action in [rpc.COPY, rpc.LINK, rpc.MOVE]: assert tgt.schema == 'file', 'staging tgt expected as file://' + # implicitly create target dir if needed - but only for local ops + if action != rpc.TRANSFER: + tgtdir = os.path.dirname(tgt.path) + if tgtdir != task_sandbox.path: + self._log.debug("mkdir %s", tgtdir) + ru.rec_makedir(tgtdir) + if action == rpc.COPY: try: shutil.copytree(src.path, tgt.path)