https://prefect.io logo
#prefect-community
Title
# prefect-community
m

Mars

07/27/2022, 9:08 PM
Hi, what is the suggested way to set a flow configuration value, like a sandbox API URL, across a flow-of-flows? We are currently using Parameters, but it appears I can only set paramters for the parent flow in the UI. I can’t directly set the child flow parameters, too.
1
n

Nate

07/27/2022, 9:16 PM
in Prefect 1.0 you can use
client.create_flow_run
, which accepts a
parameters
kwarg as shown here (in the Python Client tab)
I saw you already mentioned that you're currently sticking with prefect 1.0, but just for context its worth mentioning that in prefect 2.0 its much simpler, you can just call any
@flow
decorated function from another flow and pass arguments like any other python function like
Copy code
from prefect import flow, task

@task(name="Print Hello")
def print_hello(name):
    msg = f"Hello {name}!"
    print(msg)
    return msg

@flow(name="My Subflow")
def my_subflow(msg):
    print(f"Subflow says: {msg}")

@flow(name="Hello Flow")
def hello_world(name="world"):
    message = print_hello(name)
    my_subflow(message)

hello_world("Marvin")
gratitude thank you 1
m

Mars

07/27/2022, 9:31 PM
Thanks! It looks like I’ll have to hoist the DAG-wide configuration parameters from the child flows into the root flow so I can set them from the UI, or whatever per-environment configuration mechanism we end up using.
4 Views