Skip to content

Commit

Permalink
Fix copy local files to nested remote target folder
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Feb 21, 2025
1 parent f4c55f5 commit ac6376c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/aiida/engine/daemon/execmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ async def _copy_local_files(logger, node, transport, inputs, local_copy_list, wo
# If the source object is a directory, we copy its entire contents
data_node.base.repository.copy_tree(filepath_target, filename_source)
await transport.put_async(
f'{dirpath}/*',
f'{filepath_target}/.',
workdir.joinpath(target) if target else workdir.joinpath('.'),
overwrite=True,
)
Expand Down
6 changes: 6 additions & 0 deletions src/aiida/transports/plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,12 @@ def mkdir(self, path: TransportPath, ignore_existing: bool = False):
if ignore_existing and self.isdir(path):
return

# check and create the parent directories recursively
parent_path = os.path.dirname(path)

if not self.isdir(parent_path):
self.mkdir(parent_path, ignore_existing=True)

try:
self.sftp.mkdir(path)
except OSError as exc:
Expand Down
1 change: 1 addition & 0 deletions tests/engine/daemon/test_execmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def test_retrieve_files_from_list(
(['sub', None], {'b': 'file_b'}),
([None, 'target'], {'target': {'sub': {'b': 'file_b'}, 'a': 'file_a'}}),
(['sub', 'target'], {'target': {'b': 'file_b'}}),
(['sub', 'target/another-sub'], {'target': {'another-sub': {'b': 'file_b'}}}),
),
)
def test_upload_local_copy_list(
Expand Down

0 comments on commit ac6376c

Please sign in to comment.