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 2020/01/15 17:31:49 UTC

[GitHub] [airflow] mattbowden-ookla commented on a change in pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries

mattbowden-ookla commented on a change in pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries
URL: https://github.com/apache/airflow/pull/6792#discussion_r367009626
 
 

 ##########
 File path: airflow/cli/commands/dag_command.py
 ##########
 @@ -208,8 +208,8 @@ def dag_state(args):
         dag = get_dag(args.subdir, args.dag_id)
     else:
         dag = get_dag_by_file_location(args.dag_id)
-    dr = DagRun.find(dag.dag_id, execution_date=args.execution_date)
-    print(dr[0].state if len(dr) > 0 else None)  # pylint: disable=len-as-condition
+    dr = DagRun.find(dag.dag_id, execution_date=args.execution_date).one_or_none()
+    print(dr.state if dr else None)  # pylint: disable=len-as-condition
 
 Review comment:
   I think the pylint disable can be removed here as a result of this change

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services