GitHub user raphaelauv edited a discussion: MappedTaskGroup without taskflow

Hi I'm trying to use dynamic task mapping on a taskgroup without the taskflow 
syntax 

It works with the taskflow syntax  -> 

```python
from datetime import timedelta
import time
from airflow import DAG
from airflow.providers.standard.operators.python import PythonOperator
from airflow.decorators import task_group
from pendulum import today

with DAG(
        dag_id="dag_group_DTM",
        start_date=today("UTC").add(days=-1),
        schedule=timedelta(days=1),
):

    first = PythonOperator(
        task_id="first",
        python_callable=lambda : [1, 10, 20, 30]
    )


    def sleep(duration):
        time.sleep(duration)

    @task_group(group_id="group_1")
    def tg1(duration):
        a = PythonOperator(task_id="a", python_callable=sleep, 
op_kwargs={"duration": duration})
        b = PythonOperator(task_id="b", python_callable=sleep, 
op_kwargs={"duration": duration})
        c = PythonOperator(task_id="c", python_callable=sleep, 
op_kwargs={"duration": duration})
        a >> b >> c

    tg1.expand(duration=first.output)

```

but I would like to not mix traditional syntax with taskflow syntax, and I did 
not yet found a way using 

```
from airflow.utils.task_group import MappedTaskGroup
```

do you have any idea if it's possible ? thanks all

GitHub link: https://github.com/apache/airflow/discussions/50297

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to