Skip to content

Commit

Permalink
fixed afew self blocking calls in copy_async()
Browse files Browse the repository at this point in the history
  • Loading branch information
khsrali committed Dec 10, 2024
1 parent a68240c commit 520e58e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- python~=3.9
- alembic~=1.2
- archive-path~=0.4.2
- asyncssh@ git+https://github.com/ronf/asyncssh.git@033ef54302b2b09d496d68ccf39778b9e5fc89e2#egg=asyncssh
- asyncssh
- circus~=0.18.0
- click-spinner~=0.1.8
- click~=8.1
Expand All @@ -23,7 +23,7 @@ dependencies:
- importlib-metadata~=6.0
- numpy~=1.21
- paramiko~=3.0
- plumpy@ git+https://github.com/aiidateam/plumpy.git@async-run#egg=plumpy
- plumpy
- pgsu~=0.3.0
- psutil~=5.6
- psycopg[binary]~=3.0
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies = [
'tabulate>=0.8.0,<0.10.0',
'tqdm~=4.45',
'upf_to_json~=0.9.2',
'wrapt~=1.11',
'wrapt~=1.11'
]
description = 'AiiDA is a workflow manager for computational science with a strong focus on provenance, performance and extensibility.'
dynamic = ['version'] # read from aiida/__init__.py
Expand Down Expand Up @@ -513,5 +513,5 @@ commands = molecule {posargs:test}
"""

[tool.uv.sources]
plumpy = { git = "https://github.com/aiidateam/plumpy", branch = "async-run" }
asyncssh = { git = "https://github.com/ronf/asyncssh", rev = "033ef54302b2b09d496d68ccf39778b9e5fc89e2" }
asyncssh = {git = "https://github.com/ronf/asyncssh", rev = "033ef54302b2b09d496d68ccf39778b9e5fc89e2"}
plumpy = {git = "https://github.com/aiidateam/plumpy", branch = "async-run"}
14 changes: 10 additions & 4 deletions src/aiida/transports/plugins/ssh_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,9 @@ async def _exec_cp(cp_exe: str, cp_flags: str, src: str, dst: str):
to_copy_list = await self.glob_async(remotesource)

if len(to_copy_list) > 1:
if not self.path_exists(remotedestination) or self.isfile(remotedestination):
if not await self.path_exists_async(remotedestination) or await self.isfile_async(
remotedestination
):
raise OSError("Can't copy more than one file in the same destination file")

for file in to_copy_list:
Expand Down Expand Up @@ -718,22 +720,26 @@ async def exec_command_wait_async(
stdin: Optional[str] = None,
encoding: str = 'utf-8',
workdir: Optional[TransportPath] = None,
timeout: Optional[float] = 2,
timeout: Optional[float] = None,
**kwargs,
):
"""Execute a command on the remote machine and wait for it to finish.
:param command: the command to execute
:param stdin: the input to pass to the command
Default = None
:param encoding: (IGNORED) this is here just to keep the same signature as the one in `Transport` class
Default = 'utf-8'
:param workdir: the working directory where to execute the command
Default = None
:param timeout: the timeout in seconds
Default = None
:type command: str
:type stdin: str
:type encoding: str
:type workdir: Union[TransportPath, None]
:type timeout: float
:type workdir: Optional[TransportPath]
:type timeout: Optional[float]
:return: a tuple with the return code, the stdout and the stderr of the command
:rtype: tuple(int, str, str)
Expand Down

0 comments on commit 520e58e

Please sign in to comment.