still wrapping my head around some concepts here, ...
# prefect-community
l
still wrapping my head around some concepts here, so bear with me. I've got a a working prototype up and running which uses a flask webapp to dispatch flows to prefect cloud. Currently, I'm seeding the data (ie the tasks and flows to run) with a "bootstrap" script that needs to run before the webapp is launched, but I'd like it really to be a "batteries included" experience. How are people generally solving this? I could have a "setup" page in my flask app, but I don't want to get super involved for now
k
So your flask webapp can trigger already registered flows if you do:
Copy code
Client().create_flow_run()
or you can even use the GraphQL API with native requests As long as you register already, then you don’t need to send flow and task code. Does that make sense?
l
yep, that's basically what I'm doing now. The only thing I'm struggling with is getting the flow id in order to trigger it
k
Ahh I see. So you can invoke a task by calling
task.run()
. For example:
Copy code
@task
def abc():
    return 1

abc.run()
This calls the Python under the hood. So I suggest you use the
create_flow_run
built-in task because the inputs are project name and flow name and it finds the id for you to trigger
Docs here. So I suggest
create_flow_run.run(project_name=…,flow_name=…)
l
oh man, can't believe I missed that! I've been hardcoding the uuid, I'll read the docs better next time. thank you!
k
Oh no worries! This one is not straightforward. You can read the source code of that task too if you want.