Thread
#prefect-community
    Jeremy Tee

    Jeremy Tee

    1 year ago
    hi everybody, i saw this in the prefect document
    from prefect import Task, Flow
    from prefect.tasks.prefect import StartFlowRun
    
    
    class ExtractSomeData(Task)
        def run(self):
            return {"param-key": "some-random-piece-of-data"}
    
    extract_some_data = ExtractSomeData(name="extract_some_data")
    
    # assumes you have registered a flow named "exampled" in a project named "examples"
    flow_run = StartFlowRun(flow_name="example", project_name="examples")
    
    with Flow("parent-flow") as flow:
        flow_run.set_upstream(extract_some_data, key="parameters")
    but i am wondering what is the
    parameters
    ? and whether the
    param-key
    from
    ExtractSomeData
    is passed into the
    example flow
    emre

    emre

    1 year ago
    The
    parameters
    input for
    StartFlowRun
    accepts a dictionary, and passes each key-value pair as a parameter to the triggered flow. So this
    StartFlowRun
    call will trigger a flow run for the flow with name
    example
    . The flow run will have a single
    Parameter
    set up. Its name will be
    "param-key"
    , value will be
    "some-random-piece-of-data"
    . Its value can be accessed with the parameter task:
    Parameter("param-key")
    within the flow named
    "example"
    . In essence, this is analogous to setting inputs in the flow run page of the prefect UI.
    In prefect core, you would do:
    flow.run(parameters={"param-key": "some-random-piece-of-data"})
    for the same effect.
    Dylan

    Dylan

    1 year ago
    Hi @Jeremy Tee! Emere is spot on here. I’ll add a final note that the
    StartFlowRun
    Task does not return data, it only kicks off the child Flow Run. If you need to send data back to the parent Flow, put that data in a known place, either by passing a parameter or using the Flow Run ID.
    Jeremy Tee

    Jeremy Tee

    1 year ago
    thank you all!