You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/12/29 00:31:13 UTC

[GitHub] jmcarp commented on a change in pull request #4396: [WIP][AIRFLOW-3585] - Adding edges to database

jmcarp commented on a change in pull request #4396: [WIP][AIRFLOW-3585] - Adding edges to database
URL: https://github.com/apache/incubator-airflow/pull/4396#discussion_r244433482
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -1505,23 +1509,27 @@ def set_duration(tid):
     def graph(self, session=None):
         dag_id = request.args.get('dag_id')
         blur = conf.getboolean('webserver', 'demo_mode')
-        dag = dagbag.get_dag(dag_id)
-        if dag_id not in dagbag.dags:
-            flash('DAG "{0}" seems to be missing.'.format(dag_id), "error")
-            return redirect('/admin/')
-
         root = request.args.get('root')
-        if root:
-            dag = dag.sub_dag(
-                task_regex=root,
-                include_upstream=True,
-                include_downstream=False)
+        if root: show_dag_id = root
+        else: show_dag_id = dag_id
+        dag = session.query(models.DagModel).filter(models.DagModel.dag_id == show_dag_id).first()
+        if not dag:
+            flash('DAG "{0}" seems to be missing.'.format(show_dag_id), "error")
+            return redirect('/admin/')
 
-        arrange = request.args.get('arrange', dag.orientation)
+        arrange = request.args.get('arrange', configuration.conf.get('webserver', 'dag_orientation'))
+        dt_nr_dr_data = get_date_time_num_runs_dag_runs_form_data(request, session, dag)
+        dt_nr_dr_data['arrange'] = arrange
+        dttm = dt_nr_dr_data['dttm']
 
+        task_instances = session.query(models.TaskInstance)\
+            .filter(models.TaskInstance.dag_id == show_dag_id)\
+            .filter(models.TaskInstance.execution_date == dttm).all()
         nodes = []
         edges = []
-        for task in dag.tasks:
+        for task in session.query(models.TaskInstance)\
 
 Review comment:
   Could we write this as `for task in task_instances` and save a query?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services