-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Closed as not planned
Labels
Can't ReproduceThe problem cannot be reproducedThe problem cannot be reproducedaffected_version:2.5Issues Reported for 2.5Issues Reported for 2.5area:corearea:dynamic-task-mappingAIP-42AIP-42kind:bugThis is a clearly a bugThis is a clearly a bugpending-responsestaleStale PRs per the .github/workflows/stale.yml policy fileStale PRs per the .github/workflows/stale.yml policy file
Description
Apache Airflow version
2.5.1
What happened
We use default_args to configure common parameters across our Airflow deployments. Some of those parameters are specific to certain operators or a group of operators.
When we use dynamic task mapping in addition to our default_args the DAG fails to parse.
What you think should happen instead
The DAG should success to parse.
How to reproduce
The DAG
from typing import List
from airflow import DAG
from airflow.decorators import task
from airflow.operators.bash import BashOperator
from airflow.utils.dates import days_ago
default_args = dict(
start_date=days_ago(1),
use_legacy_sql=False,
something="else",
)
@task
def get_commands() -> List[str]:
return [
"echo hello",
"echo world",
]
with DAG(
"test_default_args",
default_args=default_args,
schedule=None,
) as dag:
commands = get_commands()
BashOperator.partial(
task_id="run_bash",
).expand(
bash_command=commands,
)will result in the following error
Broken DAG: [/usr/local/airflow/dags/test_dynamic_args.py] Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/airflow/models/mappedoperator.py", line 149, in __attrs_post_init__
validate_mapping_kwargs(self.operator_class, "partial", self.kwargs)
File "/usr/local/lib/python3.9/site-packages/airflow/models/mappedoperator.py", line 109, in validate_mapping_kwargs
raise TypeError(f"{op.__name__}.{func}() got {error}")
TypeError: BashOperator.partial() got unexpected keyword arguments 'use_legacy_sql', 'something'
Operating System
Debian GNU/Linux 11 (bullseye)
Versions of Apache Airflow Providers
apache-airflow-providers-amazon==6.2.0
apache-airflow-providers-apache-hive==5.1.1
apache-airflow-providers-apache-livy==3.2.0
apache-airflow-providers-celery==3.1.0
apache-airflow-providers-cncf-kubernetes==5.1.1
apache-airflow-providers-common-sql==1.3.3
apache-airflow-providers-databricks==4.0.0
apache-airflow-providers-dbt-cloud==2.3.1
apache-airflow-providers-elasticsearch==4.3.3
apache-airflow-providers-ftp==3.3.0
apache-airflow-providers-google==8.8.0
apache-airflow-providers-http==4.1.1
apache-airflow-providers-imap==3.1.1
apache-airflow-providers-microsoft-azure==5.1.0
apache-airflow-providers-postgres==5.4.0
apache-airflow-providers-redis==3.1.0
apache-airflow-providers-sftp==4.2.1
apache-airflow-providers-snowflake==4.0.2
apache-airflow-providers-sqlite==3.3.1
apache-airflow-providers-ssh==3.4.0Deployment
Astronomer
Deployment details
We use Astronomer Runtime 7.2.0.
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
bryzgaloff, vchiapaikeo, AdamStormhardtGH, m-aciek, roman-affirm and 6 more
Metadata
Metadata
Assignees
Labels
Can't ReproduceThe problem cannot be reproducedThe problem cannot be reproducedaffected_version:2.5Issues Reported for 2.5Issues Reported for 2.5area:corearea:dynamic-task-mappingAIP-42AIP-42kind:bugThis is a clearly a bugThis is a clearly a bugpending-responsestaleStale PRs per the .github/workflows/stale.yml policy fileStale PRs per the .github/workflows/stale.yml policy file