From 0341582b90631c17baf626f105544c56b3433d52 Mon Sep 17 00:00:00 2001 From: Alexander Goscinski Date: Thu, 16 Jan 2025 16:03:09 +0100 Subject: [PATCH] Fix usage of `RemoteData` in arguments The tests did not cover the usage of `RemoteData` in the arguments which did not cover the bug that `self.handle_remote_data` does not exist. We translate the node by passing the path to the arguments. --- src/aiida_shell/calculations/shell.py | 2 +- tests/test_launch.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/aiida_shell/calculations/shell.py b/src/aiida_shell/calculations/shell.py index 078d200..600cf9f 100644 --- a/src/aiida_shell/calculations/shell.py +++ b/src/aiida_shell/calculations/shell.py @@ -407,7 +407,7 @@ def process_arguments_and_nodes( self.write_folder_data(node, dirpath, filename) argument_interpolated = argument.format(**{placeholder: filename or placeholder}) elif isinstance(node, RemoteData): - self.handle_remote_data(node) + argument_interpolated = argument.format(**{placeholder: node.get_remote_path()}) else: argument_interpolated = argument.format(**{placeholder: str(node.value)}) diff --git a/tests/test_launch.py b/tests/test_launch.py index 5a1edb2..fd9a8ca 100644 --- a/tests/test_launch.py +++ b/tests/test_launch.py @@ -140,12 +140,13 @@ def test_nodes_remote_data(tmp_path, aiida_localhost, use_symlinks): (dirpath_sub_filled / 'file_b.txt').write_text('content b') # Create a ``RemoteData`` node of the ``archive`` directory which should contain only the ``archive.zip`` file. + remote_zip = RemoteData(remote_path=str(dirpath_archive / 'archive'), computer=aiida_localhost) remote_data = RemoteData(remote_path=str(dirpath_archive), computer=aiida_localhost) results, node = launch_shell_job( 'unzip', - arguments=['archive.zip'], - nodes={'remote': remote_data}, + arguments=['{remote_zip}'], + nodes={'remote_zip': remote_zip, 'remote': remote_data}, outputs=['file_a.txt'], metadata={ 'options': {'use_symlinks': use_symlinks},