Skip to content

Commit

Permalink
Merge pull request #125 from openclimatefix/issue/sentry
Browse files Browse the repository at this point in the history
add sentry app
  • Loading branch information
peterdudfield authored Sep 3, 2024
2 parents 52f728c + 7548f91 commit 98d86a1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pvnet_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import pvnet
from pvnet.models.base_model import BaseModel as PVNetBaseModel
from pvnet.utils import GSPLocationLookup
import sentry_sdk

import pvnet_app
from pvnet_app.utils import (
Expand All @@ -56,6 +57,15 @@
)
from pvnet_app.forecast_compiler import ForecastCompiler

# sentry
sentry_sdk.init(
dsn=os.getenv("SENTRY_DSN", ""),
environment=f'{os.getenv("ENVIRONMENT", "local")}',
traces_sample_rate=1.0,
profiles_sample_rate=1.0,
)
sentry_sdk.set_tag("app_name", "pvnet_app")

# ---------------------------------------------------------------------------
# GLOBAL SETTINGS

Expand Down Expand Up @@ -215,14 +225,22 @@ def app(
):
"""Inference function for production
This app expects these evironmental variables to be available:
This app expects these environmental variables to be available:
- DB_URL
- NWP_UKV_ZARR_PATH
- NWP_ECMWF_ZARR_PATH
- SATELLITE_ZARR_PATH
The following are options
- PVNET_V2_VERSION, pvnet version, default is a version above
- PVNET_V2_SUMMATION_VERSION, the pvnet version, default is above
- DOWNLOAD_SATELLITE, option to get satelite data. defaults to true
- USE_SATELLITE, option to get satellite data. defaults to true
- USE_ADJUSTER, option to use adjuster, defaults to true
- SAVE_GSP_SUM, option to save gsp sum, defaults to false
- RUN_EXTRA_MODELS, option to run extra models, defaults to false
- DAY_AHEAD_MODEL, option to use day ahead model, defaults to false
- SENTRY_DSN, optional link to sentry
- ENVIRONMENT, the environment this is running in, defaults to local
Args:
t0 (datetime): Datetime at which forecast is made
gsp_ids (array_like): List of gsp_ids to make predictions for. This list of GSPs are summed
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ typer
testcontainers
xesmf==0.8.7
huggingface-hub==0.24.1
sentry-sdk==2.13.0

0 comments on commit 98d86a1

Please sign in to comment.