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 2022/07/29 14:21:54 UTC

[GitHub] [airflow] jedcunningham opened a new pull request, #25402: Refactor DAG pages to be consistent

jedcunningham opened a new pull request, #25402:
URL: https://github.com/apache/airflow/pull/25402

   There were a few DAG pages that were inconsistent:
   - Missing error handling for non-existing dag_ids
   - Not passing the orm model for the templates use (most notably missing
     the "next run" info in the header)


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] jedcunningham commented on a diff in pull request #25402: Refactor DAG pages to be consistent

Posted by GitBox <gi...@apache.org>.
jedcunningham commented on code in PR #25402:
URL: https://github.com/apache/airflow/pull/25402#discussion_r933496392


##########
airflow/www/views.py:
##########
@@ -1237,31 +1237,27 @@ def legacy_code(self):
     @provide_session
     def code(self, dag_id, session=None):
         """Dag Code."""
-        all_errors = ""
-        dag_orm = None
+        dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
+        dag_model = DagModel.get_dagmodel(dag_id, session=session)
+        if not dag:
+            flash(f'DAG "{dag_id}" seems to be missing.', "error")
+            return redirect(url_for('Airflow.index'))

Review Comment:
   Yeah, if you look down we were passing the orm dag as both the orm dag and the "normal" dag. This was doing the wrong thing before, even if it did work. That might mean we can simplify further, but that'll be another time.



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] dstandish commented on a diff in pull request #25402: Refactor DAG pages to be consistent

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #25402:
URL: https://github.com/apache/airflow/pull/25402#discussion_r933489202


##########
airflow/www/views.py:
##########
@@ -1237,31 +1237,27 @@ def legacy_code(self):
     @provide_session
     def code(self, dag_id, session=None):
         """Dag Code."""
-        all_errors = ""
-        dag_orm = None
+        dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
+        dag_model = DagModel.get_dagmodel(dag_id, session=session)
+        if not dag:
+            flash(f'DAG "{dag_id}" seems to be missing.', "error")
+            return redirect(url_for('Airflow.index'))

Review Comment:
   ```
           dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
           if not dag:
               flash(f'DAG "{dag_id}" seems to be missing.', "error")
               return redirect(url_for('Airflow.index'))
   ```
   
   curious why we add this portion?  it seems that we didn't previously retrieve the dag object?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] jedcunningham merged pull request #25402: Refactor DAG pages to be consistent

Posted by GitBox <gi...@apache.org>.
jedcunningham merged PR #25402:
URL: https://github.com/apache/airflow/pull/25402


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] dstandish commented on a diff in pull request #25402: Refactor DAG pages to be consistent

Posted by GitBox <gi...@apache.org>.
dstandish commented on code in PR #25402:
URL: https://github.com/apache/airflow/pull/25402#discussion_r933506164


##########
airflow/www/views.py:
##########
@@ -1237,31 +1237,27 @@ def legacy_code(self):
     @provide_session
     def code(self, dag_id, session=None):
         """Dag Code."""
-        all_errors = ""
-        dag_orm = None
+        dag = get_airflow_app().dag_bag.get_dag(dag_id, session=session)
+        dag_model = DagModel.get_dagmodel(dag_id, session=session)
+        if not dag:
+            flash(f'DAG "{dag_id}" seems to be missing.', "error")
+            return redirect(url_for('Airflow.index'))

Review Comment:
   ah i see, thought that was in another method for some reason



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org