-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Description
Apache Airflow version
3.0.6
If "Other Airflow 2 version" selected, which one?
No response
What happened?
Summary
Since Airflow 3.0 (tested on 3.0.6), it is impossible to use expand on a @task_group containing a task decorated with @task.kubernetes_cmd.
Expansion works correctly for a standalone @task.kubernetes_cmd task, or for a @task_group containing a @task.kubernetes task, but fails in the specific case of a task group + kubernetes_cmd.
The mapped data is not correctly interpreted or propagated.
This code raises an error or does not correctly map the values to the internal TaskGroup task (echo_cmd).
Note: If you replace @task.kubernetes_cmd with @task.kubernetes, it works as expected.
Expected behavior
- Expansion (
expand) on a TaskGroup containing a@task.kubernetes_cmdtask should work just like with other TaskFlow-compatible tasks.
Observed behavior
- The mapping/expand does not pass the expected values to the internal task within the TaskGroup.
- The value injected into the internal task is a
MappedArgumentobject (e.g.,<airflow.models.xcom_arg.MappedArgument object at ...>) instead of the actual value (e.g."foo","bar"). - There is no similar issue with
@task.kubernetesin the same scenario.
Technical details
- When mapping via
expandon a@task_groupcontaining a@task.kubernetes_cmdtask, the value received by the internal task is an unresolvedMappedArgumentobject.
Environment
- Airflow: 3.0.6
- Deployment: via the official Helm chart (apache/airflow)
- Image used:
apache/airflow:3.0.6 - Python version: not explicitly set, using the official image default
Notes / leads
- It seems that expand/mapping on TaskGroups does not work with this specific decorator, while it does with others.
- No existing issue found as of October 2025.
Thanks for your help and for all your great work on Airflow!
What you think should happen instead?
No response
How to reproduce
from airflow.decorators import dag, task, task_group
from datetime import datetime
@dag(start_date=datetime(2023,1,1), schedule=None, catchup=False)
def demo():
@task
def make_values():
return ["foo", "bar", "baz"]
@task.kubernetes_cmd(image="alpine")
def echo_cmd(name):
return ["echo", name]
@task_group
def group_task(name):
echo_cmd(name)
# This works:
# echo_cmd.expand(name=make_values())
# This does NOT work:
group_task.expand(name=make_values())
dag = demo()Operating System
apache/airflow:3.0.6
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct