08/06/2022, 12:59 AM
Have a general question about migrating from Prefect 1.0 to 2.0. In 1.0 there was a generic
parameter that you could pass to tasks so that each task knew to wait for the previous one to run. Through my reading of the documentation it seems like this is not necessary anymore b/c everything should run like it would in Python so it basically defaults to a sequential executor. Is this the correct logic? Obviously this story changes a bit when adding in the different
Task Runners
but just wanted to confirm that using default code blocks that tasks run in sequence and won't run the next task until the previous one is complete.
āœ… 3

Nico Neumann

08/06/2022, 1:04 AM
In prefect 2.0 it was unified to
As for as I know default should be to run task in sequential order, so there is no need to include
šŸ™ 1
šŸ™Œ 2
Just tried it:
Copy code
from prefect import flow, get_run_logger, task

def task1():
    logger = get_run_logger()
    while True:

def task2():
    logger = get_run_logger()
    while True:

@flow(name="Test Flow")
def flow_run():
    raise Exception()

It prints task1 forever and never raises the Exception because it waits forever for the first task to finish
@Keith Just had a look in the documentation: The default task_runner is
ConcurrentTaskRunner Depends on your use case you might want to switch to
@Anna Gellerā€™s message explains it well that it only runs in parallel when explicitly calling with .submit or .map:;cid=CL09KU1K7
šŸ™Œ 1
šŸ™ 1
upvote 1
šŸ™ 1
šŸ‘ 1