Hafsa Junaid

07/31/2022, 4:02 PM
Through the following code, I am trying to run a flow on prefect cloud. But it was getting in scheduled and pending state then I added .start() line of code with agent, the flow was no more scheduled but when I am trying to do the same with a new flow it is just running an agent. Is this a right way bcz its just running agent but not registering the new version until I stop the agent*?*
@task(log_stdout=True, result=LocalResult())
def hello_world():
    text = f"hello to {FLOW_NAME}"
    return text

from prefect.agent.local import LocalAgent
from prefect.run_configs import LocalRun

with Flow(
    FLOW_NAME, storage=STORAGE, run_config=LocalRun(labels=["xyz"])
) as flow:
    data = hello_world()

@Anna Geller @Nate

Anna Geller

07/31/2022, 6:00 PM
please don't tag anyone
:upvote: 1
are you new to Prefect? if so, try Prefect 2.0 which is LTS version Prefect 1.0 is in a maintenance mode, 2.0 is LTS so better to get started with that one
:upvote: 1