GitHub user raphaelauv added a comment to the discussion: Dynamic mapped tasks
group arguments are interpreted as MappedArgument when provided to classic
operators
@potiuk what do you think to re-open this issue ?
would be great to be able to mix easily between taskflow and traditional syntax
```python
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.map(lambda x:x*2)})
b = PythonOperator(task_id="b", python_callable=sleep,
op_kwargs={"duration": duration})
a >> b
tg1.expand(duration=first.output.map(lambda x:x//2))
```
here it fail with
```log
Broken DAG: [/opt/airflow/dags/XXXX.py]
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/decorators/task_group.py",
line 101, in _create_task_group
retval = self.function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/airflow/dags/dag_6.py", line 29, in tg1
a = PythonOperator(task_id="a", python_callable=sleep,
op_kwargs={"duration": duration.map(lambda x:x*2)})
^^^^^^^^^^^^
AttributeError: 'MappedArgument' object has no attribute 'map'
```
GitHub link:
https://github.com/apache/airflow/discussions/40728#discussioncomment-13144383
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]