Skip to content

Commit

Permalink
allow setting of log level through env var
Browse files Browse the repository at this point in the history
and bump mlde_utils now that it has debug logging in ClipT
  • Loading branch information
henryaddison committed Feb 27, 2024
1 parent 915c3fc commit e8e4885
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DERIVED_DATA=/path/to/derived_data
LOG_LEVEL=INFO
9 changes: 8 additions & 1 deletion bin/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path

from codetiming import Timer
from dotenv import load_dotenv
from knockknock import slack_sender
from ml_collections import config_dict
import numpy as np
Expand Down Expand Up @@ -52,8 +53,14 @@
subVPSDE,
)

load_dotenv() # take environment variables from .env.

logging.basicConfig(
level=logging.INFO,
format="%(levelname)s - %(filename)s - %(asctime)s - %(message)s",
)
logger = logging.getLogger()
logger.setLevel("INFO")
logger.setLevel(os.environ.get("LOG_LEVEL", "INFO").upper())

app = typer.Typer()

Expand Down
12 changes: 6 additions & 6 deletions environment.lock.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: cuda-downscaling
channels:
- pytorch
- pyviz
- conda-forge
- defaults
- nodefaults
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_kmp_llvm
Expand Down Expand Up @@ -42,12 +41,12 @@ dependencies:
- brotlipy=0.7.0=py39hb9d737c_1005
- bzip2=1.0.8=h7f98852_4
- c-ares=1.18.1=h7f98852_0
- ca-certificates=2023.5.7=hbcca054_0
- ca-certificates=2024.2.2=hbcca054_0
- cachetools=5.2.0=pyhd8ed1ab_0
- cairo=1.16.0=ha61ee94_1014
- cartopy=0.21.1=py39h6e7ad6e_0
- cdo=2.1.0=h15029e1_0
- certifi=2023.5.7=pyhd8ed1ab_0
- certifi=2024.2.2=pyhd8ed1ab_0
- cf-units=3.1.1=py39h2ae25f5_2
- cffi=1.15.1=py39he91dace_3
- cfgv=3.3.1=pyhd8ed1ab_0
Expand Down Expand Up @@ -224,7 +223,7 @@ dependencies:
- oauthlib=3.2.2=pyhd8ed1ab_0
- openh264=2.1.1=h780b84a_0
- openjpeg=2.5.0=h7d73246_1
- openssl=3.1.0=hd590300_3
- openssl=3.2.1=hd590300_0
- orc=1.8.1=hfdbbad2_0
- ossuuid=1.6.2=hf484d3e_1000
- packaging=21.3=pyhd8ed1ab_0
Expand Down Expand Up @@ -269,6 +268,7 @@ dependencies:
- python=3.9.15=hba424b6_0_cpython
- python-cdo=1.5.7=pyhd8ed1ab_0
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python-dotenv=1.0.1=pyhd8ed1ab_0
- python-telegram-bot=13.15=pyhd8ed1ab_0
- python-xxhash=3.0.0=py39hb9d737c_2
- python_abi=3.9=3_cp39
Expand Down Expand Up @@ -368,4 +368,4 @@ dependencies:
- mlde-utils==0.0.4
- netcdf4==1.6.3
- python-cmethods==1.0.1
prefix: /home/henry/mambaforge/envs/cuda-downscaling
prefix: /home/henry/miniforge3/envs/cuda-downscaling
1 change: 1 addition & 0 deletions environment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pre-commit
pytest
python=3.9.15
python-cdo
python-dotenv>=1.0,<2
pytorch=1.12.1=py3.9_cuda11.3_cudnn8.3.2_0
shortuuid
tensorboard
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flufl-lock
mlde-utils ~=0.0.4
mlde-utils ~=0.0.5
python-cmethods

0 comments on commit e8e4885

Please sign in to comment.