Skip to content
Snippets Groups Projects
Commit 47654c95 authored by Eterevskiy Georgiy's avatar Eterevskiy Georgiy
Browse files

Merge branch 'feature/AUTO-3851' into 'master'

Исправлена работа с операциями в классе ExtensionService

See merge request perxis/perxis-python!78
parents 2fbb962b 0b65f8d6
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ class ExtensionService( ...@@ -94,7 +94,7 @@ class ExtensionService(
clients: list[clients_pb2.Client] = [] clients: list[clients_pb2.Client] = []
actions: list[dict] = [] actions: list[dict] = []
__operations: dict[str, OperationMeta] = {} __operations: dict[str, OperationMeta]
def __init__(self, def __init__(self,
collections_service: collections_pb2_grpc.CollectionsStub, collections_service: collections_pb2_grpc.CollectionsStub,
...@@ -137,6 +137,8 @@ class ExtensionService( ...@@ -137,6 +137,8 @@ class ExtensionService(
self.roles_service, self.clients_service, self.items_service, self.roles_service, self.clients_service, self.items_service,
) )
self.__operations = {}
for collection in self.collections or []: for collection in self.collections or []:
self.extension_setup.add_collection(collection) self.extension_setup.add_collection(collection)
...@@ -153,6 +155,10 @@ class ExtensionService( ...@@ -153,6 +155,10 @@ class ExtensionService(
async def remove_old_operations(): async def remove_old_operations():
self.remove_old_operations() self.remove_old_operations()
@property
def operations(self):
return self.__operations
def remove_old_operations(self): def remove_old_operations(self):
self.logger.info("Удаление старых операций") self.logger.info("Удаление старых операций")
...@@ -234,6 +240,12 @@ class ExtensionService( ...@@ -234,6 +240,12 @@ class ExtensionService(
description=description description=description
) )
def mark_operation_as_finished(self, operation_id: str, errors: list[str] | None = None):
if operation_id in self.operations:
self.operations[operation_id].mark_finished(errors)
else:
self.logger.error(f"Операция {operation_id} не найдена!")
async def _Install(self, operation_id: str, request: extension_service_pb2.InstallRequest, context): async def _Install(self, operation_id: str, request: extension_service_pb2.InstallRequest, context):
errors_list = await self.extension_setup.install( errors_list = await self.extension_setup.install(
request.space_id, request.env_id, request.force request.space_id, request.env_id, request.force
...@@ -241,7 +253,7 @@ class ExtensionService( ...@@ -241,7 +253,7 @@ class ExtensionService(
self.result_log("установки", operation_id, request, errors_list) self.result_log("установки", operation_id, request, errors_list)
self.__operations[operation_id].mark_finished(errors_list) self.mark_operation_as_finished(operation_id, errors_list)
async def Install(self, request: extension_service_pb2.InstallRequest, context): async def Install(self, request: extension_service_pb2.InstallRequest, context):
operation_id = generate_operation_id() operation_id = generate_operation_id()
...@@ -265,7 +277,7 @@ class ExtensionService( ...@@ -265,7 +277,7 @@ class ExtensionService(
self.result_log("удаления", operation_id, request, errors_list) self.result_log("удаления", operation_id, request, errors_list)
self.__operations[operation_id].mark_finished(errors_list) self.mark_operation_as_finished(operation_id, errors_list)
async def Uninstall(self, request: extension_service_pb2.UninstallRequest, context): async def Uninstall(self, request: extension_service_pb2.UninstallRequest, context):
operation_id = generate_operation_id() operation_id = generate_operation_id()
......
...@@ -14,7 +14,7 @@ def load_requirements(): ...@@ -14,7 +14,7 @@ def load_requirements():
setup( setup(
name='perxis', name='perxis',
version='1.8.0', version='1.8.1',
description='Perxis python client', description='Perxis python client',
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment