f

    Felipe Saldana

    1 year ago
    Hello Prefect. I have a question about dealing with Flow Parameters. Whats the preferred way to concatenate flow parameters that will be passed into a number of task? Let me type up a simplified example below
    Say I have the following incoming parameters. I would like to concatenate these to create proper paths/variables such as
    lake2_staging
    ,
    lake2_prepublish
    ,
    lake1_publish
    ,
    lake2_publish
    etc.
    lake1_root_dir = Parameter("lake1_root_dir", required=True)
    lake2_root_dir = Parameter("lake2_root_dir", required=True)
    publish_dir = Parameter("publish_dir", required=True)
    output_dir = Parameter("output_dir", required=True)
    staging_dir = Parameter("staging_dir", required=True)
    prepublish_dir = Parameter("prepublish_dir", required=True)
    source_data_dir = Parameter("source_data_dir", required=True)
    
    
    lake2_staging = lake2_root_dir + "/" + staging_dir
    lake2_prepublish = lake2_root_dir + "/" + prepublish_dir
    
    lake1_publish = lake1_root_dir + "/" + publish_dir + "/" + output_dir
    lake2_publish = lake2_root_dir + "/" + publish_dir + "/" + output_dir
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Felipe Saldana, I think you really need to make a task that takes in these and creates the string.
    @task
    def make_path(root, env, output):
        return f"{root}/{env}/{output}"
    f

    Felipe Saldana

    1 year ago
    Hey @Kevin Kho, thats what I was thinking. Hmmm, almost like a flow property in a sense.
    And then I could pass the result of
    make_path
    and any proper parameters into the actual task
    Kevin Kho

    Kevin Kho

    1 year ago
    yes you can
    f

    Felipe Saldana

    1 year ago
    Thanks again @Kevin Kho.... I appreciate the quick response