Samuel Tober

    Samuel Tober

    1 year ago
    Hi everyone! I am using .map() to run a task with a list as parameter, but I do not get a desired behaviour. For example, if I specify a parameter as:
    markets = Parameter('markets', default=['stockholm', 'oslo'])
    And then run a function:
    total_df = load_data.map(
        city=markets,
        date_from=date_from
    )
    where I pass a single value parameter, date_from, and my list parameter markets. Everything runs without error, however, the function is only run for the first value in the markets list. What I want is to run for each value in markets, using the same value of date_from for each element in markets. How can I achieve this?
    Yueh-Han

    Yueh-Han

    1 year ago
    Hey @Samuel Tober - good question and good use of Prefect Map feature! For constant value in mapping, you can utilized the
    unmapped
    method in Prefect: https://docs.prefect.io/core/concepts/mapping.html#unmapped-inputs
    And if that doesn’t work, let me know! we can solve this together
    Samuel Tober

    Samuel Tober

    1 year ago
    Awesome, works like a charm! Thanks for the quick response
    Yueh-Han

    Yueh-Han

    1 year ago
    Glad to hear!