Support for flows with intersecting branches
See original GitHub issueI’d like to implement flow in which its branches intersects with each other like:
Code:
from metaflow import FlowSpec, step
class TestFlow(FlowSpec):
@step
def start(self):
self.next(self.a, self.b)
@step
def a(self):
self.next(self.a1, self.a2)
@step
def a1(self):
self.next(self.a1b1)
@step
def a2(self):
self.next(self.a2b2)
@step
def b(self):
self.next(self.b1, self.b2)
@step
def b1(self):
self.next(self.a1b1)
@step
def b2(self,):
self.next(self.a2b2)
@step
def a1b1(self, inputs):
self.merge_artifacts(inputs)
self.next(self.join)
@step
def a2b2(self, inputs):
self.merge_artifacts(inputs)
self.next(self.join)
@step
def join(self, inputs):
self.merge_artifacts(inputs)
self.next(self.end)
@step
def end(self):
pass
if __name__ == "__main__":
TestFlow()
It throws error:
Step a1b1 joins steps from unrelated splits. Ensure that there is a matching join for every split.
I know I can reimplement this like:
Code:
from metaflow import FlowSpec, step
class TestFlow(FlowSpec):
@step
def start(self):
self.next(self.a, self.b)
@step
def a(self):
self.next(self.a1, self.a2)
@step
def a1(self):
self.next(self.a12)
@step
def a2(self):
self.next(self.a12)
@step
def b(self):
self.next(self.b1, self.b2)
@step
def b1(self):
self.next(self.b12)
@step
def b2(self,):
self.next(self.b12)
@step
def a12(self, inputs):
self.merge_artifacts(inputs)
self.next(self.as_bs)
@step
def b12(self, inputs):
self.merge_artifacts(inputs)
self.next(self.as_bs)
@step
def as_bs(self, inputs):
self.merge_artifacts(inputs)
self.next(self.end)
@step
def end(self):
pass
if __name__ == "__main__":
TestFlow()
In my case looking from a perspective of visual graph second implementation looks cleaner, but from implementation perspective it brings unnecessary additional steps.
Are there any plans to add support for this kind of Flows? Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Joining a parallel action to an already existing flow
I.e., add another parallel branch to the two existing branches, ending with the already existing intersection. Message 10 of 20. 7,932 Views.
Read more >New Implementation of Unions and Intersections
If a branch succeeds, we are done. The final case is where the branch looks promising, but we cannot be sure without adding...
Read more >Modeling branched and intersecting faults in reservoir ...
branched and intersecting faults is a challenge, in particular when the fault- s work as internal fluid flow conduits that allow fluid flow...
Read more >Branch collar - Wikipedia
A branch collar is the "shoulder" between the branch and trunk of woody plants; ... at the base of the branch is caused...
Read more >Possible flow scenarios for a four pipe intersection. (flow may ...
The four flow scenarios possible at an intersection are shown diagrammatically in Fig. 2. Intersections with fewer than four branches or sharp turns...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@valayDave The exact implementation, as well as UX for sub-workflows, is TBD.
Makes sense. We are discussing a number of enhancements to the flow structure, including introducing the notion of sub workflows, but the timing is TBD.