https://prefect.io logo
Title
j

Jason Carter

07/24/2020, 5:44 PM
Hello, I have another "quick" question branching from my previous issue. 1. If I make a change to my file say
first_flow.py
do I have to run
python first_flow.py
in order to get it to register the change? (
flow.register()
is in my py file) 2. I'm now seeing my flow in the UI but when I try to run it via the UI (as a one off run) it goes into "scheduled to run" but late and never runs (i just mark as cancel after 3mins).
import prefect
from prefect import task, Flow

@task
def hello_task():
    logger = prefect.context.get("logger")
    <http://logger.info|logger.info>("Hello, Cloud!")

flow = Flow("hello-flow", tasks=[hello_task])

# flow.run()
flow.register()
https://prefect-community.slack.com/archives/CL09KU1K7/p1595532174143800
m

Matt Allen

07/24/2020, 5:45 PM
Calling
flow.register()
is what builds the updated docker image and tells the prefect agent about the new version of the flow, so yeah it's required every time the code changes
My plan is to run that script from within gitlabci on every build, it's basically the "deploy" step
n

nicholas

07/24/2020, 5:50 PM
Hi @Jason Carter - @Matt Allen is correct, when your code changes you'll need to let Prefect know. The exception to this is when using file-based storage, which allows non-structural code to change between runs without re-registering the flow. You can read more about that here: https://docs.prefect.io/core/idioms/file-based.html#using-file-based-flow-storage
As for the late runs, you'll need to have an Agent configured with the same labels as your flow, to make sure it picks up scheduled runs.
j

Jason Carter

07/24/2020, 5:56 PM
Thanks @Matt Allen and @nicholas the deploy script as a step makes sense. And thanks for the info on the file based storage I'll read up on that. As for the agent, all i did was start the docker agent so that must be the issue. I'll look into the labels. Just an FYI - I think a # step flow for a hello world would be helpful. It seems like everything content wise is documented but no TLDR section to get a flow running in x steps (but perhaps I missed it)
n

nicholas

07/24/2020, 5:58 PM
Totally agreed @Jason Carter - it's something we're actively working on and should have some good stuff soon 😄
👍🏾 1