ashb commented on a change in pull request #7370: [AIRFLOW-6590] Use batch db 
operations in jobs
URL: https://github.com/apache/airflow/pull/7370#discussion_r377594151
 
 

 ##########
 File path: scripts/perf/sql_queries.py
 ##########
 @@ -0,0 +1,178 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+from time import sleep, time
+from typing import List, NamedTuple, Optional, Tuple
+
+import pandas as pd
+
+# Setup environment before any Airflow import
+DAG_FOLDER = "/opt/airflow/scripts/perf/dags"
+os.environ["AIRFLOW__CORE__DAGS_FOLDER"] = DAG_FOLDER
+os.environ["AIRFLOW__DEBUG__SQLALCHEMY_STATS"] = "True"
+os.environ["AIRFLOW__CORE__LOAD_EXAMPLES"] = "False"
+
+# Here we setup simpler logger to avoid any code changes in
+# Airflow core code base
+LOG_LEVEL = "INFO"
+LOG_FILE = "/files/sql_stats.log"  # Default to run in Breeze
 
 Review comment:
   Fair enough :)
   
   Could do `"/files//sql_stats.log" if os.path.exisxts("/.dockerenv") else 
"sql_stats.log"`
   
   But also will accept that this only affects those like me who don't use 
breeze all the time, so I'll fix it up if/when I come to run this script :)

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


With regards,
Apache Git Services

Reply via email to