Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5279,7 +5279,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"end_date",
"note",
"external_trigger",
"conf",
# "conf",
"duration",
]
search_columns = [
Expand All @@ -5303,7 +5303,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"start_date",
"end_date",
"run_id",
"conf",
# "conf",
"note",
]

Expand All @@ -5319,7 +5319,7 @@ class DagRunModelView(AirflowPrivilegeVerifierModelView):
"end_date",
# "note", # todo: maybe figure out how to re-enable this
"external_trigger",
"conf",
# "conf",
]

base_order = ("execution_date", "desc")
Expand Down Expand Up @@ -5347,7 +5347,7 @@ def duration_f(self):
"queued_at": wwwutils.datetime_f("queued_at"),
"dag_id": wwwutils.dag_link,
"run_id": wwwutils.dag_run_link,
"conf": wwwutils.json_f("conf"),
# "conf": wwwutils.json_f("conf"),
"duration": duration_f,
}

Expand Down
52 changes: 52 additions & 0 deletions tests/www/views/test_views_dagrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,58 @@ def test_get_dagrun_can_view_dags_without_edit_perms(session, running_dag_run, c
check_content_in_response(dag_url_link, resp)


class CustomClass:
attribute = None


@pytest.fixture()
def dag_run_with_problematic_config(session):
"""Airflow 2.6 allows users to create DAG Runs which have configuration values in the scheduler that
cannot be parsed in the webserver."""
invalid_config = {"custom_class_instance": CustomClass()}
dag = DagBag().get_dag("example_bash_operator")
execution_date = timezone.datetime(2016, 1, 9)

dr = dag.create_dagrun(
state="running",
execution_date=execution_date,
data_interval=(execution_date, execution_date),
run_id="test_dag_runs_action",
conf=invalid_config,
session=session,
)
session.add(dr)
tis = [
TaskInstance(dag.get_task("runme_0"), run_id=dr.run_id, state="success"),
TaskInstance(dag.get_task("runme_1"), run_id=dr.run_id, state="failed"),
]
session.bulk_save_objects(tis)
session.commit()

yield dr

session.query(DagRun).delete()
session.query(TaskInstance).delete()


def test_get_dagrun_error_problematic_dagrun_config(
session, dag_run_with_problematic_config, client_dr_without_dag_edit
):
"""Test that a config which cannot be parsed in the webserver does not interfere with listing DAG Runs"""
assert session.query(DagRun).filter(DagRun.dag_id == dag_run_with_problematic_config.dag_id).count() == 1
resp = client_dr_without_dag_edit.get("/dagrun/list/", follow_redirects=True)
with client_dr_without_dag_edit.application.test_request_context():
url = flask.url_for(
"Airflow.graph",
dag_id=dag_run_with_problematic_config.dag_id,
execution_date=dag_run_with_problematic_config.execution_date,
)
dag_url_link = markupsafe.Markup('<a href="{url}">{dag_id}</a>').format(
url=url, dag_id=dag_run_with_problematic_config.dag_id
)
check_content_in_response(dag_url_link, resp)


def test_create_dagrun_permission_denied(session, client_dr_without_dag_edit):
data = {
"state": "running",
Expand Down