Hello, I have another "quick" question branching f...
# prefect-community
j
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).
Copy code
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
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
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
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
Totally agreed @Jason Carter - it's something we're actively working on and should have some good stuff soon 😄
👍🏾 1