https://prefect.io logo
Title
e

Eric

09/20/2020, 1:59 AM
can I skip this step if I run this in my flow .py ?
n

nicholas

09/20/2020, 2:01 AM
Hi @Eric - yes! Those are two variations of the same command, one for programmatic registration and the other for Cli registration
e

Eric

09/20/2020, 2:01 AM
ah great okay thank you. is it safe to just keep the registration in the flow.py and then I guess do git commit, push, then run the ptyhon code (thus registering the flow)?
n

nicholas

09/20/2020, 2:03 AM
Yup, that should be fine 👍
e

Eric

09/20/2020, 2:03 AM
thank you for answering ona weekend!
are you familiar with the github storage backend?
n

nicholas

09/20/2020, 2:07 AM
Yup, so long as the structure of your flow doesn’t change, you won’t need to reregister with intra-task code changes.
e

Eric

09/20/2020, 2:11 AM
any thoughts why my flow just stays in the flow run scheduled state?
i'm now, this is my first flow, running on cloud version with github backend
i set up my secret and am usign the storage like this:
flow.run() runs fine locally
agent is running on EKS, seems fine
but not picking up the job, just stuck in scheduled state
n

nicholas

09/20/2020, 2:18 AM
Definitely - what are the labels attached to your flow? You can see these from the details tile on the Flow page.
e

Eric

09/20/2020, 2:19 AM
n

nicholas

09/20/2020, 2:19 AM
There it is - go ahead and remove that github-flow-storage label
For an agent to pick up any given flow, it must have all of the labels of that flow
e

Eric

09/20/2020, 2:20 AM
is it bad practice to not use labels at all? also how did this label get set? i didnt set it
also how can you set the Agent's label?
n

nicholas

09/20/2020, 2:22 AM
Not bad practice at all - labels are a way of organizing flows and separating environments, and as such they're completely optional. This one was set because certain storage and environments automatically set labels on registration.
e

Eric

09/20/2020, 2:23 AM
can i override that so it defaults to None?
n

nicholas

09/20/2020, 2:23 AM
You can set labels on your agent using the
--l
flag: you can view all the agent options here: https://docs.prefect.io/api/latest/cli/agent.html#agent
e

Eric

09/20/2020, 2:23 AM
so my agent will pick it up?
n

nicholas

09/20/2020, 2:23 AM
You can just remove it from the flow page and your agent should pick it up
e

Eric

09/20/2020, 2:24 AM
going forward can i set the label to None in code so I dont have to remember to remove the label manually in the UI?
ah okay they are running now after I removed the filter
I tried setting th elabel to None, but still passing github-flow-storage when registering
i set up another agent with this label
so workaround for now, let me know if you have a way to set the labels to None when registering a flow using Github storage 🙂 thank you!!
n

nicholas

09/21/2020, 5:06 PM
Hi @Eric - sorry for the delay here! You can remove default labels by passing
add_default_label=False
to your storage call, like this:
flow.storage = GitHub(
    repo="some_repo",
    path="flows/my_flow.py",
    secrets=["github_token"],
    add_default_labels=False,
)