I’m a little confused with the migration from v1 t...
# ask-community
s
I’m a little confused with the migration from v1 to Orion. Should we continue to use .map? Or write async tasks?
k
2.0 is Dags free so you can use it like how you would use Python. That means that instead of:
Copy code
from prefect import Flow, task

@task
def add_ten(x):
    return x + 10

with Flow('simple map') as flow:
    mapped_result = add_ten.map([1, 2, 3])
You can simply write this:
Copy code
from prefect import flow, task

@task
def add_ten(x):
    return x + 10

@flow 
def my_flow():
    result = [add_ten(num) for num in [1, 2, 3])
You can use async in 2.0
s
subtle difference though in that you would now have to call sumbit() to really make those calls concurrent e.g.
result = add_ten.submit(num) for num in [1, 2, 3]
k
that is true. It is because a lot of Prefect users are not using concurrency and were confused about why the returned result is not a Python object. Since we prioritize incremental adoption, we set the default return value of a task to be a Python object
z
We’ve also got the
map
operator still, which will run your tasks concurrently. It doesn’t support DFE yet though.