Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blank dag dependencies view #17990

Merged
merged 2 commits into from
Sep 2, 2021
Merged
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
2 changes: 1 addition & 1 deletion airflow/www/templates/airflow/dag_dependencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h2>
<span class="legend-item trigger">trigger</span>
<span class="legend-item sensor">sensor</span>
</div>
<div style="float:right">Last refresh: {{ last_refresh }}</div>
<div style="float:right">Last refresh: <time datetime="{{ last_refresh }}">{{ last_refresh }}</time></div>
</div>
<div id="error" style="display: none; margin-top: 10px;" class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
Expand Down
7 changes: 5 additions & 2 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,10 @@ def list(self):
"""Display DAG dependencies"""
title = "DAG Dependencies"

if timezone.utcnow() > self.last_refresh + self.refresh_interval:
if not self.nodes or not self.edges:
self._calculate_graph()
self.last_refresh = timezone.utcnow()
elif timezone.utcnow() > self.last_refresh + self.refresh_interval:
max_last_updated = SerializedDagModel.get_max_last_updated_datetime()
if max_last_updated is None or max_last_updated > self.last_refresh:
self._calculate_graph()
Expand All @@ -4305,7 +4308,7 @@ def list(self):
title=title,
nodes=self.nodes,
edges=self.edges,
last_refresh=self.last_refresh.strftime("%Y-%m-%d %H:%M:%S"),
last_refresh=self.last_refresh,
arrange=conf.get("webserver", "dag_orientation"),
width=request.args.get("width", "100%"),
height=request.args.get("height", "800"),
Expand Down