From 3ec7463faaba2d6e509e66a2bc4ce45339436a32 Mon Sep 17 00:00:00 2001 From: Maxim Podosochnyy <podosochnyy@perx.ru> Date: Thu, 27 Feb 2025 09:30:02 +0300 Subject: [PATCH 1/4] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B5=20Extens?= =?UTF-8?q?ionService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- perxis-proto | 2 +- perxis/extensions/extension_service.py | 18 +++++++++++++++--- setup.py | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/perxis-proto b/perxis-proto index 0627c9f..f10336d 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit 0627c9f829178bc6de2623a0b6d42964c44de496 +Subproject commit f10336dc4a4f58111c12dd95afec82be18388803 diff --git a/perxis/extensions/extension_service.py b/perxis/extensions/extension_service.py index 14b07f1..94a479e 100644 --- a/perxis/extensions/extension_service.py +++ b/perxis/extensions/extension_service.py @@ -94,7 +94,7 @@ class ExtensionService( clients: list[clients_pb2.Client] = [] actions: list[dict] = [] - __operations: dict[str, OperationMeta] = {} + __operations: dict[str, OperationMeta] def __init__(self, collections_service: collections_pb2_grpc.CollectionsStub, @@ -137,6 +137,8 @@ class ExtensionService( self.roles_service, self.clients_service, self.items_service, ) + self.__operations = {} + for collection in self.collections or []: self.extension_setup.add_collection(collection) @@ -153,6 +155,10 @@ class ExtensionService( async def remove_old_operations(): self.remove_old_operations() + @property + def operations(self): + return self.__operations + def remove_old_operations(self): self.logger.info("Удаление старых операций") @@ -234,6 +240,12 @@ class ExtensionService( 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): errors_list = await self.extension_setup.install( request.space_id, request.env_id, request.force @@ -241,7 +253,7 @@ class ExtensionService( 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): operation_id = generate_operation_id() @@ -265,7 +277,7 @@ class ExtensionService( 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): operation_id = generate_operation_id() diff --git a/setup.py b/setup.py index 84d4659..3e806b5 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def load_requirements(): setup( name='perxis', - version='1.8.0', + version='1.8.1', description='Perxis python client', long_description=long_description, long_description_content_type='text/markdown', -- GitLab From bbafc1d416083ff0d279ccbdc47d1ccd21f6949e Mon Sep 17 00:00:00 2001 From: Maxim Podosochnyy <podosochnyy@perx.ru> Date: Thu, 27 Feb 2025 09:45:17 +0300 Subject: [PATCH 2/4] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B5=20Extens?= =?UTF-8?q?ionService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index 79c7c1e..5895c03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "perxis-proto"] path = perxis-proto url = https://git.perx.ru/perxis/perxis-proto.git + branch = 0627c9f829178bc6de2623a0b6d42964c44de496 -- GitLab From 878d17480515527a04dc72b6c999996350e966fe Mon Sep 17 00:00:00 2001 From: Maxim Podosochnyy <podosochnyy@perx.ru> Date: Thu, 27 Feb 2025 10:37:31 +0300 Subject: [PATCH 3/4] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B5=20Extens?= =?UTF-8?q?ionService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitmodules | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 5895c03..79c7c1e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,3 @@ [submodule "perxis-proto"] path = perxis-proto url = https://git.perx.ru/perxis/perxis-proto.git - branch = 0627c9f829178bc6de2623a0b6d42964c44de496 -- GitLab From 0b65f8d65b402bf4fc81458dddfd093878efda56 Mon Sep 17 00:00:00 2001 From: Maxim Podosochnyy <podosochnyy@perx.ru> Date: Thu, 27 Feb 2025 10:54:09 +0300 Subject: [PATCH 4/4] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D1=81=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8=20=D0=B2=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B5=20Extens?= =?UTF-8?q?ionService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- perxis-proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perxis-proto b/perxis-proto index f10336d..0627c9f 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit f10336dc4a4f58111c12dd95afec82be18388803 +Subproject commit 0627c9f829178bc6de2623a0b6d42964c44de496 -- GitLab