From 6627b21fe308cf4d727d1761b687d6315e8fc4fa Mon Sep 17 00:00:00 2001 From: Ali Date: Fri, 13 Dec 2024 12:35:32 +0100 Subject: [PATCH] update asyncssh dependency --- environment.yml | 2 +- pyproject.toml | 2 +- src/aiida/transports/plugins/ssh_async.py | 23 ++++++++++++++++------- tests/cmdline/commands/test_computer.py | 10 +++++++++- tests/transports/test_all_plugins.py | 4 +++- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/environment.yml b/environment.yml index 8862430c4..9ce52da6f 100644 --- a/environment.yml +++ b/environment.yml @@ -8,7 +8,7 @@ dependencies: - python~=3.9 - alembic~=1.2 - archive-path~=0.4.2 -- asyncssh +- asyncssh~=2.19.0 - circus~=0.18.0 - click-spinner~=0.1.8 - click~=8.1 diff --git a/pyproject.toml b/pyproject.toml index 971f338e8..92afa8986 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ dependencies = [ 'alembic~=1.2', 'archive-path~=0.4.2', - "asyncssh", + "asyncssh~=2.19.0", 'circus~=0.18.0', 'click-spinner~=0.1.8', 'click~=8.1', diff --git a/src/aiida/transports/plugins/ssh_async.py b/src/aiida/transports/plugins/ssh_async.py index c0d875b8a..307cffbbf 100644 --- a/src/aiida/transports/plugins/ssh_async.py +++ b/src/aiida/transports/plugins/ssh_async.py @@ -64,6 +64,8 @@ async def attempt_connection(): class AsyncSshTransport(AsyncTransport): """Transport plugin via SSH, asynchronously.""" + _DEFAULT_max_io_allowed = 8 + # note, I intentionally wanted to keep connection parameters as simple as possible. _valid_auth_options = [ ( @@ -84,7 +86,7 @@ class AsyncSshTransport(AsyncTransport): 'max_io_allowed', { 'type': int, - 'default': 8, + 'default': _DEFAULT_max_io_allowed, 'prompt': 'Maximum number of concurrent I/O operations.', 'help': 'Depends on various factors, such as your network bandwidth, the server load, etc.' ' (An experimental number)', @@ -117,23 +119,30 @@ def _get_machine_suggestion_string(cls, computer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.machine = kwargs.pop('machine_or_host') - self._max_io_allowed = kwargs.pop('max_io_allowed') + # the machine is passed as `machine=computer.hostname` in the codebase + # 'machine' is immutable. + # 'machine_or_host' is mutable, so it can be changed via command: + # 'verdi computer configure core.ssh_async