From db52fe7c2f8f89e4260b35f472785870eee013bb Mon Sep 17 00:00:00 2001 From: mhh Date: Tue, 14 Nov 2023 17:36:31 +0100 Subject: [PATCH] Fix formatting and interface issues --- src/aleph/sdk/client/abstract.py | 3 ++- src/aleph/sdk/client/authenticated_http.py | 13 +++++-------- tests/unit/test_asynchronous.py | 3 ++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/aleph/sdk/client/abstract.py b/src/aleph/sdk/client/abstract.py index e07e8dcc..bff6a227 100644 --- a/src/aleph/sdk/client/abstract.py +++ b/src/aleph/sdk/client/abstract.py @@ -26,7 +26,6 @@ from aleph_message.status import MessageStatus from ..query.filters import MessageFilter, PostFilter -from ..query.params import VmParams from ..query.responses import PostsResponse from ..types import GenericMessage, StorageEnum from ..utils import Writable @@ -368,6 +367,7 @@ async def create_instance( aleph_api: bool = True, encoding: Encoding = Encoding.zip, volumes: Optional[List[Mapping]] = None, + volume_persistence: str = "host", ssh_keys: Optional[List[str]] = None, metadata: Optional[Mapping[str, Any]] = None, ) -> Tuple[AlephMessage, MessageStatus]: @@ -390,6 +390,7 @@ async def create_instance( :param aleph_api: Whether the VM needs access to Aleph messages API (Default: True) :param encoding: Encoding to use (Default: Encoding.zip) :param volumes: Volumes to mount + :param volume_persistence: Where volumes are persisted, can be "host" or "store", meaning distributed across Aleph.im (Default: "host") :param ssh_keys: SSH keys to authorize access to the VM :param metadata: Metadata to attach to the message """ diff --git a/src/aleph/sdk/client/authenticated_http.py b/src/aleph/sdk/client/authenticated_http.py index d095cec2..4a274a05 100644 --- a/src/aleph/sdk/client/authenticated_http.py +++ b/src/aleph/sdk/client/authenticated_http.py @@ -13,6 +13,8 @@ AlephMessage, ForgetContent, ForgetMessage, + InstanceContent, + InstanceMessage, ItemType, MessageType, PostContent, @@ -20,7 +22,7 @@ ProgramContent, ProgramMessage, StoreContent, - StoreMessage, InstanceMessage, InstanceContent, + StoreMessage, ) from aleph_message.models.execution.base import Encoding from aleph_message.models.execution.environment import ( @@ -35,7 +37,6 @@ from ..conf import settings from ..exceptions import BroadcastError, InvalidMessageError -from ..query.params import VmParams from ..types import Account, StorageEnum from .abstract import AuthenticatedAlephClient from .http import AlephHttpClient @@ -465,9 +466,7 @@ async def create_program( if runtime == settings.DEFAULT_RUNTIME_ID else "", ), - volumes=[ - MachineVolume.parse_obj(volume) for volume in volumes - ], + volumes=[MachineVolume.parse_obj(volume) for volume in volumes], time=time.time(), metadata=metadata, ) @@ -539,9 +538,7 @@ async def create_instance( if rootfs == settings.DEFAULT_RUNTIME_ID else "", ), - volumes=[ - MachineVolume.parse_obj(volume) for volume in volumes - ], + volumes=[MachineVolume.parse_obj(volume) for volume in volumes], time=time.time(), authorized_keys=ssh_keys, metadata=metadata, diff --git a/tests/unit/test_asynchronous.py b/tests/unit/test_asynchronous.py index 5fcbd8a2..104482da 100644 --- a/tests/unit/test_asynchronous.py +++ b/tests/unit/test_asynchronous.py @@ -5,9 +5,10 @@ from aleph_message.models import ( AggregateMessage, ForgetMessage, + InstanceMessage, PostMessage, ProgramMessage, - StoreMessage, InstanceMessage, + StoreMessage, ) from aleph_message.status import MessageStatus