diff --git a/pvnet_app/app.py b/pvnet_app/app.py index 25c50de..6814c87 100644 --- a/pvnet_app/app.py +++ b/pvnet_app/app.py @@ -80,24 +80,29 @@ # --------------------------------------------------------------------------- # LOGGER + +class SQLAlchemyFilter(logging.Filter): + + def filter(self, record): + return "sqlalchemy" not in record.pathname + +# Create a logger +logger = logging.getLogger() +logger.setLevel(logging.INFO) + formatter = logging.Formatter( fmt="[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s" ) stream_handler = logging.StreamHandler() stream_handler.setFormatter(formatter) - -logging.basicConfig( - level=getattr(logging, os.getenv("LOGLEVEL", "INFO")), - format="[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s", -) - -logger = logging.getLogger(__name__) logger.addHandler(stream_handler) -# Get rid of these verbose logs +# Get rid of the verbose sqlalchemy logs +stream_handler.addFilter(SQLAlchemyFilter()) sql_logger = logging.getLogger("sqlalchemy.engine.Engine") sql_logger.addHandler(logging.NullHandler()) + # --------------------------------------------------------------------------- # APP MAIN diff --git a/pvnet_app/data.py b/pvnet_app/data.py index 1b20359..f6fa5d1 100644 --- a/pvnet_app/data.py +++ b/pvnet_app/data.py @@ -29,7 +29,7 @@ def download_all_sat_data(): fs = fsspec.open(sat_download_path).fs if fs.exists(sat_download_path): fs.get(sat_download_path, "sat_5_min.zarr.zip") - os.system(f"unzip sat_5_min.zarr.zip -d {sat_5_path}") + os.system(f"unzip -qq sat_5_min.zarr.zip -d {sat_5_path}") # Also download 15-minute satellite if it exists sat_15_dl_path = os.environ["SATELLITE_ZARR_PATH"]\