in o2a/converter/workflow_xml_parser.py [0:0]
def parse_fork_node(self, root, fork_node):
"""
Fork nodes need to be dummy operators with multiple parallel downstream
tasks.
This parses the fork node, the action nodes that it references and then
the join node at the end.
This will only parse well-formed xml-adhering workflows where all paths
end at the join node.
"""
fork_name = fork_node.attrib["name"]
mapper = ForkMapper(oozie_node=fork_node, name=fork_name, dag_name=self.workflow.dag_name)
oozie_control_node = OozieControlNode(mapper)
mapper.on_parse_node()
logging.info(f"Parsed {mapper.name} as Fork Node.")
paths = []
for node in fork_node:
if "path" in node.tag:
# Parse all the downstream tasks that can run in parallel.
curr_name = node.attrib["start"]
paths.append(xml_utils.find_node_by_name(root, curr_name))
self.workflow.nodes[fork_name] = oozie_control_node
for path in paths:
oozie_control_node.downstream_names.append(path.attrib["name"])
logging.info(f"Added {mapper.name}'s downstream: {path.attrib['name']}")
# Theoretically these will all be action nodes, however I don't
# think that is guaranteed.
# The end of the execution path has not been reached
self.parse_node(root, path)
if path.attrib["name"] not in self.workflow.nodes:
root.remove(path)