From 71662d0a93f9320a5d042d21f1b99065748ec692 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Mon, 20 Nov 2023 16:02:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?minor:=20=E5=8E=BB=E9=99=A4any=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E5=BD=93=E5=89=8D=E6=AD=A3=E5=9C=A8=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E8=8A=82=E7=82=B9=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pipeline/contrib/rollback/handler.py | 22 +++++-------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/runtime/bamboo-pipeline/pipeline/contrib/rollback/handler.py b/runtime/bamboo-pipeline/pipeline/contrib/rollback/handler.py index 691cff2..de5240e 100644 --- a/runtime/bamboo-pipeline/pipeline/contrib/rollback/handler.py +++ b/runtime/bamboo-pipeline/pipeline/contrib/rollback/handler.py @@ -94,7 +94,7 @@ def validate_token(root_pipeline_id, start_node_id, target_node_id): ) @staticmethod - def validate_node_state_by_token_mode(root_pipeline_id, start_node_id): + def validate_node_state(root_pipeline_id, start_node_id): """ 使用token模式下的回滚,相同token的节点不允许有正在运行的节点 """ @@ -122,18 +122,6 @@ def validate_node_state_by_token_mode(root_pipeline_id, start_node_id): ) ) - @staticmethod - def validate_node_state_by_any_mode(root_pipeline_id): - """ - 使用any模式下的回滚, 不允许有正在运行的节点 - """ - if ( - State.objects.filter(root_id=root_pipeline_id, name=states.RUNNING) - .exclude(node_id=root_pipeline_id) - .exists() - ): - raise RollBackException("rollback failed: there is currently the some node is running") - @staticmethod def validate_start_node_id(root_pipeline_id, start_node_id): """ @@ -262,12 +250,12 @@ def retry_rollback_failed_node(self, node_id, retry_data): raise RollBackException("rollback failed: when mode is any, not support retry") def rollback(self, start_node_id, target_node_id, skip_rollback_nodes=None): - RollbackValidator.validate_node_state_by_any_mode(self.root_pipeline_id) - # 回滚的开始节点运行失败的情况 RollbackValidator.validate_start_node_id(self.root_pipeline_id, start_node_id) RollbackValidator.validate_node(start_node_id, allow_failed=True) RollbackValidator.validate_node(target_node_id) RollbackValidator.validate_token(self.root_pipeline_id, start_node_id, target_node_id) + # 相同token回滚时,不允许同一token路径上有正在运行的节点 + RollbackValidator.validate_node_state(self.root_pipeline_id, start_node_id) node_map = self._get_allowed_rollback_node_map() rollback_graph = RollbackGraphHandler(node_map=node_map, start_id=start_node_id, target_id=target_node_id) @@ -354,11 +342,11 @@ def rollback(self, start_node_id, target_node_id, skip_rollback_nodes=None): if skip_rollback_nodes is None: skip_rollback_nodes = [] - # 相同token回滚时,不允许有正在运行的节点 - RollbackValidator.validate_node_state_by_token_mode(self.root_pipeline_id, start_node_id) # 回滚的开始节点运行失败的情况 RollbackValidator.validate_node(start_node_id, allow_failed=True) RollbackValidator.validate_node(target_node_id) + # 相同token回滚时,不允许同一token路径上有正在运行的节点 + RollbackValidator.validate_node_state(self.root_pipeline_id, start_node_id) RollbackValidator.validate_token(self.root_pipeline_id, start_node_id, target_node_id) # 如果开始节点是失败的情况,则跳过该节点的回滚操作 From 93056aaac5ac5246a2723b310e212c92992cc706 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Mon, 20 Nov 2023 16:05:47 +0800 Subject: [PATCH 2/3] minor: release bamboo-pipeline 3.29.0rc4 --- runtime/bamboo-pipeline/pipeline/__init__.py | 2 +- runtime/bamboo-pipeline/pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/bamboo-pipeline/pipeline/__init__.py b/runtime/bamboo-pipeline/pipeline/__init__.py index 92dc81e..a3f486e 100644 --- a/runtime/bamboo-pipeline/pipeline/__init__.py +++ b/runtime/bamboo-pipeline/pipeline/__init__.py @@ -13,4 +13,4 @@ default_app_config = "pipeline.apps.PipelineConfig" -__version__ = "3.29.0rc3" +__version__ = "3.29.0rc4" diff --git a/runtime/bamboo-pipeline/pyproject.toml b/runtime/bamboo-pipeline/pyproject.toml index 3f15a31..925eee8 100644 --- a/runtime/bamboo-pipeline/pyproject.toml +++ b/runtime/bamboo-pipeline/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "bamboo-pipeline" -version = "3.29.0rc3" +version = "3.29.0rc4" description = "runtime for bamboo-engine base on Django and Celery" authors = ["homholueng "] license = "MIT" From ea4fdfd6e236ea4928310bb74671f787e199d7c3 Mon Sep 17 00:00:00 2001 From: hanshuaikang <1758504262@qq.com> Date: Mon, 20 Nov 2023 16:39:33 +0800 Subject: [PATCH 3/3] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=E5=BF=AB?= =?UTF-8?q?=E7=85=A7=E5=9B=9E=E6=BB=9A=E6=97=B6=E5=8F=8D=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/bamboo-pipeline/pipeline/contrib/rollback/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/bamboo-pipeline/pipeline/contrib/rollback/tasks.py b/runtime/bamboo-pipeline/pipeline/contrib/rollback/tasks.py index cabd7c4..259df0c 100644 --- a/runtime/bamboo-pipeline/pipeline/contrib/rollback/tasks.py +++ b/runtime/bamboo-pipeline/pipeline/contrib/rollback/tasks.py @@ -100,8 +100,8 @@ def execute_rollback(self): node_snapshots = RollbackNodeSnapshot.objects.filter(node_id=self.node_id, rolled_back=False).order_by("-id") for node_snapshot in node_snapshots: service = self.runtime.get_service(code=node_snapshot.code, version=node_snapshot.version) - data = ExecutionData(inputs=json.loads(node_snapshot.inputs), outputs=json.loads(node_snapshot.outputs)) - parent_data = ExecutionData(inputs=json.loads(node_snapshot.context_values), outputs={}) + data = ExecutionData(inputs=node_snapshot.inputs, outputs=node_snapshot.outputs) + parent_data = ExecutionData(inputs=node_snapshot.context_values, outputs={}) result = service.service.rollback(data, parent_data, self.retry_data) node_snapshot.rolled_back = True node_snapshot.save()