https://prefect.io logo
v

Vipul

08/28/2020, 3:35 PM
Hey Team, I have a query, I am running flow.register() from within the Flask app and I could see as many time Flask app is run, I could see new version from UI. How do I avoid re-registering of the flow? Thanks
n

nicholas

08/28/2020, 3:38 PM
Hi @Vipul - the most straightforward way to handle this would be to either register the flow elsewhere (maybe as part of a manual command that can be run at will), or by querying the API to see if the flow has already been registered with a query like this:
Copy code
query {
  flow(where: { name: { _eq: "My Flow" } }) {
    id
  }
}
v

Vipul

08/28/2020, 3:41 PM
Thanks @nicholas The problem would be the Flask app should know the flow id so that it can trigger this flow based on the Flask end points are hit. Thanks for pointing me to those query but I am not sure how do I put that to code in the Flask app
n

nicholas

08/28/2020, 3:45 PM
You can use the result of that^ to set the flow id in your app as you expect
v

Vipul

08/28/2020, 3:46 PM
Cool, thanks for the pointer, I will check
👍 1
Thanks @nicholas it stopped re-registering of task
*flow
n

nicholas

08/28/2020, 7:59 PM
Fantastic!
2 Views