Mansour Zayer
03/10/2023, 6:50 PMFlow
instead of @flow
):
def create_flow(flow_name, param):
def general_func(param):
do_something(param)
return Flow(general_func, name=flow_name)
my_flow_1 = create_flow(flow_name="my_flow_1", param=ex_1)
my_flow_2 = create_flow(flow_name="my_flow_2", param=ex_2)
Now this works fine locally. But when I deploy to the Prefect cloud, I get this error when I run the flow (deployment is fine):
raise MissingFlowError(prefect.exceptions.MissingFlowError: Flow function with name 'general_func' not found in {my directory}.
Why is it expecting a flow called general_func
? How can I fix this?
p.s. I don't want my general_func to be a subflow.
ThanksZanie
my_flow_#
instead of us inferring it from the function attached to the flowMansour Zayer
03/13/2023, 5:17 PMcreate_flow
layer, so it would be:
## flows.py
def general_func(param):
do_something(param)
my_flow_1 = Flow(general_func, name="my_flow_1")
my_flow_2 = Flow(general_func, name="my_flow_2")
And imported them in the deployment script:
## directory overview
- flows.py
- general_func
- my_flow_1
- my_flow_2
- deployment.py
- import my_flow_#
- build_from_flow()
But I still get raise MissingFlowError(prefect.exceptions.MissingFlowError: Function with name 'general_func' is not a flow. Make sure that it is decorated with '@flow'.
Is it even possible to create multiple flows from the same function like I'm trying to do with Flow
?Zanie
Mansour Zayer
03/13/2023, 8:22 PM