Skip to content

Commit

Permalink
minor: 支持子流程回滚
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshuaikang committed Sep 15, 2023
1 parent aed377c commit ae798d0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions runtime/bamboo-pipeline/pipeline/contrib/rollback/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def build(self, node_id, source_id=None):
return
node_type = node_detail["type"]

if node_type in [PE.ExclusiveGateway, PE.ParallelGateway, PE.ConditionalParallelGateway, PE.ConvergeGateway]:
if node_type not in [PE.ServiceActivity]:
self.others_nodes.append(node_id)

if node_type == PE.ServiceActivity:
Expand All @@ -95,16 +95,21 @@ def build(self, node_id, source_id=None):
# 如果遍历到目标节点,则返回
if node_id == self.start_id:
return

source_id = next_node_id
targets = node_detail.get("targets", {}).values()
elif node_type == PE.SubProcess:
# 处理子流程
source_id = self.build(node_detail["start_event_id"], source_id)
targets = node_detail.get("targets", {}).values()
elif node_type == PE.ExclusiveGateway:
targets = [target for target in node_detail.get("targets", {}).values() if target in self.node_map.keys()]
else:
targets = node_detail.get("targets", {}).values()

for target in targets:
self.build(target, source_id)
source_id = self.build(target, source_id)

return source_id

def build_rollback_graph(self):
"""
Expand Down

0 comments on commit ae798d0

Please sign in to comment.