diff --git a/labgrid/remote/client.py b/labgrid/remote/client.py index 731e81950..5ab4f0683 100755 --- a/labgrid/remote/client.py +++ b/labgrid/remote/client.py @@ -23,6 +23,7 @@ from collections import defaultdict, OrderedDict from datetime import datetime from pprint import pformat +from typing import Any, Dict import attr import grpc @@ -1566,7 +1567,19 @@ def ensure_event_loop(external_loop=None): return loop -def start_session(address, extra=None, debug=False, loop=None): +def start_session( + address: str, *, extra: Dict[str, Any] = None, debug: bool = False, loop: "asyncio.AbstractEventLoop | None" = None +): + """ + Starts a ClientSession. + + Args: + address: coordinator address as HOST[:PORT], PORT defaults to 20408 + extra: additional kwargs for ClientSession + debug: set debug mode of the event loop + loop: explicit event loop to use (otherwise a previously stashed loop, + if retrievable the current thread's loop or a new loop is used) + """ loop = ensure_event_loop(loop) if extra is None: diff --git a/labgrid/resource/remote.py b/labgrid/resource/remote.py index 1b8256ef0..b8adb2524 100644 --- a/labgrid/resource/remote.py +++ b/labgrid/resource/remote.py @@ -22,7 +22,7 @@ def _start(self): from ..remote.client import start_session try: - self.session = start_session(self.url, {'env': self.env}) + self.session = start_session(self.url, extra={'env': self.env}) except ConnectionRefusedError as e: raise ConnectionRefusedError(f"Could not connect to coordinator {self.url}") \ from e