Hi team, wondering if it's possible to write a for...
# flyte-support
m
Hi team, wondering if it's possible to write a for loop in workflow and run tasks? the parameter changes in each loop, i got some type error like: argument 1 must be str, not Promise
Copy code
@workflow()
def backfill(end_of_end_date: str = None, start_of_start_date: str=None, look_back: str = None) -> int:
    end_date = datetime.strptime(end_of_end_date, "%Y-%m-%d")
    start_date = datetime.strptime(start_of_start_date, "%Y-%m-%d")
    while start_date >= datetime.strptime(start_of_start_date, "%Y-%m-%d"):

        main(end_date=end_date.strftime("%Y-%m-%d"), look_back=look_back)
        end_date -= timedelta(days=1)
        start_date -= timedelta(days=1)

    return 0
cc @average-finland-92144
f
Workflows are static
If you want to change the parameter of hen you have to use recursion in dynamic
But we have something interesting that might help
m
yeah
if you could share it would be fantasti
also I'm curious if you have example of the recursion
f
Check the merge sort example
m
thanks it works!