https://prefect.io logo
a

Alric

07/12/2023, 7:43 AM
Hello, When deploying a flow with 2 subflows. Is it possible to trigger manually (from the UI or the API) only 1 subflow among the 2 subflows ? Thank you
d

Deceivious

07/12/2023, 8:44 AM
Its up to the developer to write codes in such manner. Prefect by default does not allow triggering subflows.
Copy code
@flow
def subflow(country:str):
	result=do_something_with_country(country)
	return result

@flow
def main_flow(countries:str=None):
	if countries is None:
		countries=["USA","Mexico","UK","Australia"]
	else:
		countries=countries.split(",")
		
	for country in countries:
		sub_flow(country)
This is the general pattern I use.
a

Alric

07/12/2023, 1:40 PM
Sure got it ! Thank's