Omar Sultan
07/03/2021, 3:39 AMKevin Kho
Omar Sultan
07/03/2021, 3:44 AMfrom prefect import Task, Flow
class RunMeFirst(Task):
def run(self):
print("I'm running first!")
class PlusOneTask(Task):
def run(self, x):
return x + 1
flow = Flow('My Imperative Flow')
plus_one = PlusOneTask()
flow.set_dependencies(
task=plus_one,
upstream_tasks=[RunMeFirst()],
keyword_tasks=dict(x=10))
flow.register(project_name="JIGSAW")
Omar Sultan
07/03/2021, 3:45 AMOmar Sultan
07/03/2021, 3:45 AMKevin Kho
Local
in the .prefect
folder in your home directory. When you register, this is getting saved there. When the agent picks up the flow, it looks for it in the Storage.
It works when you run the agent locally because it goes to the .prefect
folder and finds the flow. If you run the agent on a different machine, it will go to the .prefect
folder but not find the flow. If you need the Flow to run on different machines, you can store it somewhere like S3
or Github
so that other machines can find it and pull it downOmar Sultan
07/03/2021, 3:51 AMOmar Sultan
07/03/2021, 3:51 AMOmar Sultan
07/03/2021, 3:55 AMOmar Sultan
07/03/2021, 3:55 AMKevin Kho