Skip to content

Not able to trigger DAG with config from UI if param is not defined in a DAG and dag_run.conf is used #33344

@vatsrahul1001

Description

@vatsrahul1001

Apache Airflow version

2.7.0rc1

What happened

As per #31583, now we can only run DAG with config from UI if DAG has params, however, if a DAG is using dag_run.conf there is no way to run with config from UI and as dag_run.conf is not deprecated most of the users will be impacted by this

@hussein-awala also mentioned it in his voting

What you think should happen instead

I think there should be a way to provide param values from UI when dag_run.conf is used in DAG

How to reproduce

Use below DAG in 2.7.0rc and you will notice there is no way to provide conf value from airflow UI

DAG CODE

from airflow.models import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator
from airflow.utils.dates import days_ago

dag = DAG(
dag_id="trigger_target_dag",
default_args={"start_date": days_ago(2), "owner": "Airflow"},
tags=["core"],
schedule_interval=None, # This must be none so it's triggered by the controller
is_paused_upon_creation=False, # This must be set so other workers can pick this dag up. mabye it's a bug idk
)

def run_this_func(**context):
print(
f"Remotely received value of {context['dag_run'].conf['message']} for key=message "
)

run_this = PythonOperator(
task_id="run_this",
python_callable=run_this_func,
dag=dag,
)

bash_task = BashOperator(
task_id="bash_task",
bash_command='echo "Here is the message: $message"',
env={"message": '{{ dag_run.conf["message"] if dag_run else "" }}'},
dag=dag,
)

Operating System

MAS os Monterey

Versions of Apache Airflow Providers

No response

Deployment

Astronomer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected_version:2.7Issues Reported for 2.7area:UIRelated to UI/UX. For Frontend Developers.area:webserverWebserver related Issueskind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions