ashb commented on a change in pull request #13199:
URL: https://github.com/apache/airflow/pull/13199#discussion_r625741144
##########
File path: airflow/www/views.py
##########
@@ -3907,6 +3907,76 @@ def autocomplete(self, session=None):
return wwwutils.json_response(payload)
+class DagDependenciesView(AirflowBaseView):
+ """View to show dependencies between DAGs"""
+
+ refresh_interval = conf.getint(
+ "webserver",
+ "dag_dependencies_refresh_interval",
+ fallback=conf.getint("scheduler", "dag_dir_list_interval"),
+ )
+ last_refresh = timezone.utcnow() - timedelta(seconds=refresh_interval)
+ nodes = []
+ edges = []
+
+ @expose('/dag-dependencies')
+ @auth.has_access(
+ [
+ (permissions.ACTION_CAN_READ,
permissions.RESOURCE_DAG_DEPENDENCIES),
+ ]
+ )
+ @gzipped
+ @action_logging
+ def list(self):
+ """Display DAG dependencies"""
+ title = "DAG Dependencies"
+
+ if timezone.utcnow() > self.last_refresh +
timedelta(seconds=self.refresh_interval):
Review comment:
```suggestion
if timezone.utcnow() > self.last_refresh + self.refresh_interval:
```
##########
File path: airflow/www/views.py
##########
@@ -3907,6 +3907,76 @@ def autocomplete(self, session=None):
return wwwutils.json_response(payload)
+class DagDependenciesView(AirflowBaseView):
+ """View to show dependencies between DAGs"""
+
+ refresh_interval = conf.getint(
+ "webserver",
+ "dag_dependencies_refresh_interval",
+ fallback=conf.getint("scheduler", "dag_dir_list_interval"),
+ )
+ last_refresh = timezone.utcnow() - timedelta(seconds=refresh_interval)
Review comment:
```suggestion
refresh_interval = timedelta(seconds=conf.getint(
"webserver",
"dag_dependencies_refresh_interval",
fallback=conf.getint("scheduler", "dag_dir_list_interval"),
))
last_refresh = timezone.utcnow() - refresh_interval
```
##########
File path: airflow/models/__init__.py
##########
@@ -28,6 +28,7 @@
from airflow.models.pool import Pool
from airflow.models.renderedtifields import RenderedTaskInstanceFields
from airflow.models.sensorinstance import SensorInstance # noqa: F401
+from airflow.models.serialized_dag import SerializedDagModel
Review comment:
This appears to be here to be able to do `models.SerializedDagModel` in
www.views, right?
If so could you change _that_ to use ` from airflow.models.serialized_dag
import SerializedDagModel`?
We want to move away from mass-auto-importing things in Airflow (as it's a
slowdown for initial process startup, and makes dependency cycles more likely).
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]