diff --git a/packages/syft/src/syft/service/migration/migration_service.py b/packages/syft/src/syft/service/migration/migration_service.py index dce89d4ed6f..eef1a113af7 100644 --- a/packages/syft/src/syft/service/migration/migration_service.py +++ b/packages/syft/src/syft/service/migration/migration_service.py @@ -246,9 +246,10 @@ def create_migrated_objects( migrated_objects: list[SyftObject], ignore_existing: bool = True, ) -> SyftSuccess: - return self._create_migrated_objects( + self._create_migrated_objects( context, migrated_objects, ignore_existing=ignore_existing ).unwrap() + return SyftSuccess(message="Created migration objects!") @as_result(SyftException) def _create_migrated_objects( @@ -311,11 +312,6 @@ def _migrate_objects( ) -> list[SyftObject]: migrated_objects = [] - # def get_sorting_key_migration(klass): - # canonical_name = klass.__canonical_name__ - # latest_version = SyftObjectRegistry.get_latest_version(canonical_name) - # return getattr(latest_version, "__migration_priority__", 0) - for klass, objects in migration_objects.items(): canonical_name = klass.__canonical_name__ latest_version = SyftObjectRegistry.get_latest_version(canonical_name) diff --git a/packages/syft/src/syft/service/migration/object_migration_state.py b/packages/syft/src/syft/service/migration/object_migration_state.py index 3920b70d3be..22363d867f2 100644 --- a/packages/syft/src/syft/service/migration/object_migration_state.py +++ b/packages/syft/src/syft/service/migration/object_migration_state.py @@ -6,7 +6,6 @@ from typing import Any # third party -import sqlalchemy from typing_extensions import Self import yaml @@ -17,7 +16,6 @@ from ...server.credentials import SyftSigningKey from ...server.credentials import SyftVerifyKey from ...store.db.stash import ObjectStash -from ...store.db.stash import with_session from ...store.document_store import PartitionKey from ...store.document_store_errors import NotFoundException from ...types.blob_storage import BlobStorageEntry @@ -34,9 +32,7 @@ from ...types.transforms import make_set_default from ...types.uid import UID from ...util.util import prompt_warning_message -from ..context import AuthedServiceContext from ..response import SyftSuccess -from ..user.user import User from ..worker.utils import DEFAULT_WORKER_POOL_NAME from ..worker.worker_image import SyftWorkerImage from ..worker.worker_pool import SyftWorker @@ -82,31 +78,6 @@ def get_by_name( filters={"canonical_name": canonical_name}, ).unwrap() - @as_result(SyftException) - @with_session - def update_root_user( - self, - context: AuthedServiceContext, - root_user: User, - session: sqlalchemy.orm.session, - ) -> SyftSuccess: - user_stash = context.server.services.user.stash - existing_user = user_stash.get_by_verify_key( - context.credentials, root_user.verify_key - ).unwrap() - stmt = user_stash.table.update().where( - user_stash.table.c.id == existing_user.id - ) - stmt = stmt.values(id=root_user.id) - result = session.execute(stmt) - session.commit() - if result.rowcount == 0: - raise NotFoundException( - f"User: {root_user.id} not found or no permission to update." - ) - - return user_stash.update(context.credentials, obj=root_user).unwrap() - @serializable() class StoreMetadata(SyftBaseObject):