Thread
#prefect-community
    Ilya Sapunov

    Ilya Sapunov

    3 months ago
    Hi I want to create multiple task instances with different credentials to get data from several accounts
    with Flow("import") as flow:
        for i in range(5):
            res = import_task(
                command="echo $CREDENTIALS",
                env={
                    "CREDENTIALS": str(i)
                },
            )
    But in that case all tasks will run in parallel, which will cause the request limits to be exceeded Can I run those tasks sequentially ?
    Anna Geller

    Anna Geller

    3 months ago
    Yes - by default your flow uses LocalExecutor and everything runs sequentially You shouldn't use a for loop in a Prefect 1.0 flow - you would need mapping for this in Prefect 2.0, you can run for loops and arbitrary Python code though