Last active
April 4, 2020 06:06
-
-
Save Bumbleblo/f18952901568fea72d8445f8ce7bf3f9 to your computer and use it in GitHub Desktop.
MetaFlow: Simple flow example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from metaflow import FlowSpec, step | |
class Flow(FlowSpec): | |
""" | |
Flow Example | |
""" | |
@step | |
def start(self): | |
""" | |
Start a flow | |
""" | |
self.next(self.task1, self.task2) | |
@step | |
def task1(self): | |
""" | |
Task 1 | |
""" | |
self.next(self.join) | |
@step | |
def task2(self): | |
""" | |
Task 2 | |
""" | |
self.next(self.join) | |
@step | |
def join(self, inputs): | |
""" | |
Merge tasks 1 and 2 | |
""" | |
self.next(self.tunning) | |
@step | |
def tunning(self): | |
""" | |
Create a list of parameters for tunning | |
""" | |
self.parameters = ['A', 'B', 'C'] | |
self.next(self.parameters_setting, foreach='parameters') | |
@step | |
def parameters_setting(self): | |
""" | |
Get one parameters and use them in that task | |
""" | |
print(f'Task with value: {self.input}') | |
self.next(self.join2) | |
@step | |
def join2(self, inputs): | |
""" | |
Merge all tunning parameters | |
""" | |
self.next(self.end) | |
@step | |
def end(self): | |
""" | |
End of history | |
""" | |
pass | |
if __name__ == '__main__': | |
Flow() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment