Shiyu Gan
04/06/2022, 6:32 AM*prefect.core.flow.Flow.run_agent*
do? It's unclear from documentation and src code, which seems to say it runs an Agent from inside a Flow, which might be confusing since I was under the impression that Agent runs Flows, not the other way around.Anna Geller
from prefect import task, Flow
@task(log_stdout=True)
def hello_world():
print("hello world")
with Flow("hello") as flow:
hw = hello_world()
You start an agent from one terminal:
prefect agent local start
Then in another terminal, you register your flow:
prefect register --project xxx -p /path/to/yourflow.py
Then you can trigger a run on the agent:
prefect run --project xxx --name yourflowname --watch
and then you should see that your agent picked up this flow runKevin Kho
Zanie
run_agent
isn’t recommended anymore, but it basically runs the agent inline instead of in a separate process as you would with prefect agent local start
. It makes sure to include the labels that your flow would need to match.Shiyu Gan
04/07/2022, 3:36 AMZanie