https://prefect.io logo
Title
c

Chu

07/23/2022, 8:38 PM
Hi Community, I’m using a flow of flow framework, and use KubernetesRun to run the flow. My rough design is like the screenshot: 1. A, B, C, D, E, F are all flows 2. C, D and E, F needs parallel running (where I will go with LocalDaskExecutor), where they basically are running some dbt jobs to do data transformation 3. A, B does not need parallel 4. currently I decide to use a parent flow (as an orchestrator) to run these 6 flows and submit to K8s My questions are : 1. where can I pass parameters (I know I can pass a dictionary params to flow.run() when local run, but no idea with
flow.run_config = KubernetesRun()
) 2. Where can I attach LocalDaskExecutor? Only to the parent flow? (Maybe for flow A, B, I just set their parameters using
unmapped()
function?) 3. Is there a way for me to test my project locally (to make sure the design works as wished) without registering every flow to the Cloud? 4. (Optional) for my use case, is there a better design to achieve my goals? Since I’m quite new to Prefect, but really astonished by its cool functionality, maybe there is some place I can make great improvements for our company Thanks! It’s a long question, but really appreciate for any help!
1
a

Anna Geller

07/23/2022, 9:46 PM
#1 there are many way to pass default parameters - either on the parameter task, on your clock, during registration, when triggering from a parent flow run you can also set parameters - check this post for more info https://www.prefect.io/guide/blog/how-to-make-your-data-pipelines-more-dynamic-using-parameters-in-prefect/ #2 on any flow #3 no, flow of flows can only be run with the backend in Prefect 1.0 since they work by making API calls i.e. orchestrator pattern, but once you switch to 2.0, you can use subflows and test parent/child flows locally
🙏 1
1
c

Chu

07/23/2022, 11:57 PM
I dont quite understand the negative impact of this, can you please elaborate more on that? “How to use dynamic values properly Some Prefect users try to use parameters for backfilling workflows. This is a common anti-pattern (don’t do this):
with Flow("backfilling_flow") as flow:
    start_date = Parameter('start_date', default='2022-01-05')
    end_date = Parameter('end_date', default='2022-01-06')
    fetch_data(start_date=start_date, end_date=end_date)
This approach will backfire as long as the default values are used.”
a

Anna Geller

07/24/2022, 1:11 AM
The antipattern mentioned here is having Parameter tasks without default values because then once you schedule or try to trigger such flow without specifying those values explicitly, this flow will fail because Prefect will not know what default value to use
1