Luuk
08/06/2021, 6:23 AMfrom prefect import task, Flow
from prefect.run_configs import DockerRun
@task
def say_hello(x=1):
return f"Test {x}'
with Flow("hello-world") as flow:
first = say_hello()
second = say_hello(2)
flow.config_run = DockerRun()
flow.register(project_name='test', labels=['prod'])
So question: How do I send the flow created inside my Azure VM to the VM's DockerAgent using the Prefect Cloud orchestration?Luuk
08/06/2021, 11:10 AMKevin Kho
Flow
gets saved in Storage
. When an agent runs the Flow
, it retrieves the Flow
from Storage
and runs it.
Storage
can be S3 or Github, or Docker. The default is Local
storage which saves the file locally and Prefect keeps track of the Local
path that contains the Flow. The agent is looking the file locally (inside the container in your case), but of course it won’t find it there because that path doesn’t exist.
You would need to use a Storage accessible by the container like S3 Storage or Github Storage. Or you could put the file in the Docker container and point to it.
I have an example here