Skip to content

Commit

Permalink
Added a few extra logging statements and updated Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
confusedmatrix committed Jan 25, 2024
1 parent 81e27cf commit 1a3c4bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim as base
FROM python:3.11-slim as base

ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
Expand All @@ -8,6 +8,9 @@ WORKDIR /app

FROM base as builder

RUN apt-get update
RUN apt-get install -y gdal-bin libgdal-dev g++

ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
Expand Down
14 changes: 9 additions & 5 deletions india_forecast_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,23 @@ def app(timestamp: dt.datetime | None, write_to_db: bool, log_level: str):
with db_conn.get_session() as session:

# 1. Get sites
log.info("Getting sites")
log.info("Getting sites...")
site_ids = get_site_ids(session)
log.info(f"Found {len(site_ids)} sites")

# 2. Load model
log.info("Loading model")
log.info("Loading model...")
model = get_model()
log.info("Loaded model")

# 3. Run model for each site
for site_id in site_ids:
log.info(f"Running model for site={site_id}")
log.info(f"Running model for site={site_id}...")
forecast_values = run_model(model=model, site_id=site_id, timestamp=timestamp)

if forecast_values is not None:

if forecast_values is None:
log.info(f"No forecast values for site_id={site_id}")
else:
# 4. Write forecast to DB or stdout
log.info(f"Writing forecast for site_id={site_id}")
forecast = {
Expand Down

0 comments on commit 1a3c4bc

Please sign in to comment.