Loading src/open_exposure_gateway/adapters/database/repos/app_instances.py +1 −5 Original line number Diff line number Diff line from uuid import UUID from sqlalchemy import delete, select from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from open_exposure_gateway.adapters.database.mappers import AppInstanceMapper Loading Loading @@ -37,7 +37,3 @@ class SqlAppInstanceRepository(AppInstanceRepository): if saved is None: raise RuntimeError("Saved app instance could not be reloaded") return saved async def delete(self, app_instance_id: UUID) -> None: stmt = delete(AppInstanceRow).where(AppInstanceRow.app_instance_id == app_instance_id) await self._session.execute(stmt) src/open_exposure_gateway/application/services/edge_application_management_service.py +5 −9 Original line number Diff line number Diff line Loading @@ -391,7 +391,7 @@ class EdgeApplicationManagementService: raise RuntimeError("AppInstanceRepository is not available") app_instance = await self._app_instance_repo.get_by_id(app_instance_id) if app_instance is None: if app_instance is None or app_instance.state == AppInstanceState.TERMINATED: raise NotFoundException(message=f"App instance {app_instance_id} not found") operation_id, correlation_id, requested_at = self._new_operation_metadata(x_correlator) Loading Loading @@ -478,15 +478,11 @@ class EdgeApplicationManagementService: ) continue if is_terminate and instance.status == "completed": # No terminal "terminated" state exists on app_instances.state # (only instantiating/ready/failed/terminating) -- once SRM # confirms teardown, the row's job is done. await self._app_instance_repo.delete(app_instance_id) continue state = AppInstanceState.TERMINATED else: state = _APP_INSTANCE_COMPLETION_STATE_MAP[instance.status] saved = await self._app_instance_repo.save( app_instance.model_copy( update={"state": _APP_INSTANCE_COMPLETION_STATE_MAP[instance.status]} ) app_instance.model_copy(update={"state": state}) ) updated_instances.append(saved) elif status == OperationStatus.FAILED: Loading src/open_exposure_gateway/domain/models/instances/enums.py +1 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,4 @@ class AppInstanceState(StrEnum): READY = "ready" FAILED = "failed" TERMINATING = "terminating" TERMINATED = "terminated" src/open_exposure_gateway/ports/database/instances.py +0 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,3 @@ class AppInstanceRepository(ABC): @abstractmethod async def save(self, app_instance: AppInstance) -> AppInstance: pass @abstractmethod async def delete(self, app_instance_id: UUID) -> None: pass tests/unit/fakes.py +0 −3 Original line number Diff line number Diff line Loading @@ -363,9 +363,6 @@ class FakeAppInstanceRepository(AppInstanceRepository): self.rows[stored.app_instance_id] = stored return stored.model_copy(deep=True) async def delete(self, app_instance_id: UUID) -> None: self.rows.pop(app_instance_id, None) class FakeCallbackRegistrationRepository(CallbackRegistrationRepository): def __init__(self) -> None: Loading Loading
src/open_exposure_gateway/adapters/database/repos/app_instances.py +1 −5 Original line number Diff line number Diff line from uuid import UUID from sqlalchemy import delete, select from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession from open_exposure_gateway.adapters.database.mappers import AppInstanceMapper Loading Loading @@ -37,7 +37,3 @@ class SqlAppInstanceRepository(AppInstanceRepository): if saved is None: raise RuntimeError("Saved app instance could not be reloaded") return saved async def delete(self, app_instance_id: UUID) -> None: stmt = delete(AppInstanceRow).where(AppInstanceRow.app_instance_id == app_instance_id) await self._session.execute(stmt)
src/open_exposure_gateway/application/services/edge_application_management_service.py +5 −9 Original line number Diff line number Diff line Loading @@ -391,7 +391,7 @@ class EdgeApplicationManagementService: raise RuntimeError("AppInstanceRepository is not available") app_instance = await self._app_instance_repo.get_by_id(app_instance_id) if app_instance is None: if app_instance is None or app_instance.state == AppInstanceState.TERMINATED: raise NotFoundException(message=f"App instance {app_instance_id} not found") operation_id, correlation_id, requested_at = self._new_operation_metadata(x_correlator) Loading Loading @@ -478,15 +478,11 @@ class EdgeApplicationManagementService: ) continue if is_terminate and instance.status == "completed": # No terminal "terminated" state exists on app_instances.state # (only instantiating/ready/failed/terminating) -- once SRM # confirms teardown, the row's job is done. await self._app_instance_repo.delete(app_instance_id) continue state = AppInstanceState.TERMINATED else: state = _APP_INSTANCE_COMPLETION_STATE_MAP[instance.status] saved = await self._app_instance_repo.save( app_instance.model_copy( update={"state": _APP_INSTANCE_COMPLETION_STATE_MAP[instance.status]} ) app_instance.model_copy(update={"state": state}) ) updated_instances.append(saved) elif status == OperationStatus.FAILED: Loading
src/open_exposure_gateway/domain/models/instances/enums.py +1 −0 Original line number Diff line number Diff line Loading @@ -6,3 +6,4 @@ class AppInstanceState(StrEnum): READY = "ready" FAILED = "failed" TERMINATING = "terminating" TERMINATED = "terminated"
src/open_exposure_gateway/ports/database/instances.py +0 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,3 @@ class AppInstanceRepository(ABC): @abstractmethod async def save(self, app_instance: AppInstance) -> AppInstance: pass @abstractmethod async def delete(self, app_instance_id: UUID) -> None: pass
tests/unit/fakes.py +0 −3 Original line number Diff line number Diff line Loading @@ -363,9 +363,6 @@ class FakeAppInstanceRepository(AppInstanceRepository): self.rows[stored.app_instance_id] = stored return stored.model_copy(deep=True) async def delete(self, app_instance_id: UUID) -> None: self.rows.pop(app_instance_id, None) class FakeCallbackRegistrationRepository(CallbackRegistrationRepository): def __init__(self) -> None: Loading