diff --git a/src/aiida/engine/daemon/execmanager.py b/src/aiida/engine/daemon/execmanager.py index 068949796..73c30cab6 100644 --- a/src/aiida/engine/daemon/execmanager.py +++ b/src/aiida/engine/daemon/execmanager.py @@ -182,7 +182,7 @@ def upload_calculation( # Since the content of the node could potentially be binary, we read the raw bytes and pass them on for filename in filenames: with NamedTemporaryFile(mode='wb+') as handle: - content = code.base.repository.get_object_content((Path(root) / filename), mode='rb') + content = code.base.repository.get_object_content(Path(root) / filename, mode='rb') handle.write(content) handle.flush() transport.put(handle.name, str(workdir.joinpath(root, filename))) diff --git a/src/aiida/transports/plugins/ssh.py b/src/aiida/transports/plugins/ssh.py index 5bc5de07d..d6159fe46 100644 --- a/src/aiida/transports/plugins/ssh.py +++ b/src/aiida/transports/plugins/ssh.py @@ -1226,17 +1226,18 @@ def listdir(self, path='.', pattern=None): :param pattern: returns the list of files matching pattern. Unix only. (Use to emulate ``ls *`` for example) """ - if not pattern: - return self.sftp.listdir(path) if path.startswith('/'): - base_dir = path + abs_dir = path else: - base_dir = os.path.join(self.getcwd(), path) + abs_dir = os.path.join(self.getcwd(), path) - filtered_list = self.glob(os.path.join(base_dir, pattern)) - if not base_dir.endswith('/'): - base_dir += '/' - return [re.sub(base_dir, '', i) for i in filtered_list] + if not pattern: + return self.sftp.listdir(abs_dir) + + filtered_list = self.glob(os.path.join(abs_dir, pattern)) + if not abs_dir.endswith('/'): + abs_dir += '/' + return [re.sub(abs_dir, '', i) for i in filtered_list] def remove(self, path): """Remove a single file at 'path'""" diff --git a/src/aiida/transports/transport.py b/src/aiida/transports/transport.py index 3c7192ffe..a6d755973 100644 --- a/src/aiida/transports/transport.py +++ b/src/aiida/transports/transport.py @@ -393,7 +393,7 @@ def exec_command_wait_bytes(self, command, stdin=None, workdir=None, **kwargs): """Execute the command on the shell, waits for it to finish, and return the retcode, the stdout and the stderr as bytes. - Enforce the execution to be run from the pwd (as given by self.getcwd), if this is not None. + Enforce the execution to be run from workdir, if this is not None. The command implementation can have some additional plugin-specific kwargs. diff --git a/tests/conftest.py b/tests/conftest.py index 3f30865d3..2166cc06c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -211,9 +211,6 @@ def _generate_calcjob_node( process_state: ProcessState = ProcessState.FINISHED, exit_status: int | None = None, entry_point: str | None = None, - inputs: dict | None = None, - outputs: dict | None = None, - repository: pathlib.Path | None = None, workdir: pathlib.Path | None = None, ): """Generate an instance of a `CalcJobNode`.. @@ -228,36 +225,8 @@ def _generate_calcjob_node( exit_status = 0 calcjob_node = CalcJobNode(process_type=entry_point) - calcjob_node.set_process_state(process_state) - - if exit_status is not None: - calcjob_node.set_exit_status(exit_status) - - if repository is not None: - calcjob_node.base.repository.put_object_from_tree(repository) - calcjob_node.set_remote_workdir(workdir) - # For storing, need to first store the input nodes, then the CalcJobNode, then the output nodes - if inputs is not None: - for input_label, input_node in inputs.items(): - calcjob_node.base.links.add_incoming( - input_node, - link_type=LinkType.INPUT_CALC, - link_label=input_label, - ) - - input_node.store() - - if outputs is not None: - # Need to first store CalcJobNode before I can attach `created` outputs - calcjob_node.store() - for output_label, output_node in outputs.items(): - output_node.base.links.add_incoming(calcjob_node, link_type=LinkType.CREATE, link_label=output_label) - - output_node.store() - - # Return unstored by default return calcjob_node return _generate_calcjob_node