brian
10/14/2021, 3:07 PMbrian
10/14/2021, 3:08 PMbrian
10/14/2021, 3:09 PMnicholas
@task
def A(dir: str):
# .. do stuff
return dir
@task
def B(dir:str):
# .. do stuff
return dir
@task
def C(dir:str):
# .. do stuff
return dir
with Flow("Unix-like Pipeline") as flow:
dir = Parameter("directory")
a = A(dir=dir)
b = B(dir=a)
c = C(dir=b)
brian
10/14/2021, 3:17 PMwith Flow("foo") as flow:
in = Parameter("input_dir")
out = Parameter("output_dir")
with Chain(in, out) as chain:
chain(A, B, C)
brian
10/14/2021, 3:19 PMbrian
10/14/2021, 3:20 PM|
so much….nicholas
nicholas
brian
10/14/2021, 3:33 PMZanie
|
implemented for tasks in PrefectZanie
def __ror__(self, other: object) -> "Task":
"""
Creates a state dependency between `self` and `other`:
`other | self --> self.set_dependencies(upstream_tasks=[other])`
Args:
- other (object): An object that will be converted to a Task and set as an
upstream dependency of this Task.
Returns:
- Task
"""
self.set_dependencies(upstream_tasks=[other])
return self
Zanie
Task
subclass that binds the return value of the upstream to the first argument of the downstream by overriding this method.nicholas
brian
10/14/2021, 3:58 PMbrian
10/14/2021, 3:59 PMKevin Kho