m1racoli opened a new issue, #29366:
URL: https://github.com/apache/airflow/issues/29366
### 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
```python
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
```log
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
```txt
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.0
```
### Deployment
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
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]