Skip to content

Commit 5302841

Browse files
committed
add loging
1 parent cce56d0 commit 5302841

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

nowcasting_datamodel/update.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def update_all_forecast_latest(forecasts: List[ForecastSQL], session: Session):
116116
"""
117117

118118
# get all latest forecasts
119+
logger.debug('Getting all latest forecasts')
119120
forecasts_historic_all_gsps = get_latest_forecast_for_gsps(
120121
session=session, historic=True, preload_children=True
121122
)
@@ -124,16 +125,21 @@ def update_all_forecast_latest(forecasts: List[ForecastSQL], session: Session):
124125

125126
# chose the correct forecast historic
126127
gsp_id = forecast.location.gsp_id
128+
logger.debug(f'Updating forecast for gsp_id {gsp_id}')
129+
127130
forecast_historic = [
128131
forecast_historic_one_gsps
129132
for forecast_historic_one_gsps in forecasts_historic_all_gsps
130133
if forecast_historic_one_gsps.location.gsp_id == gsp_id
131134
]
132135
if len(forecast_historic) == 0:
133136
forecast_historic = None
137+
logger.debug(f'Could not find historic, so will be creating one (GSP id{gsp_id})')
134138
else:
135139
forecast_historic = forecast_historic[0]
136140

141+
logger.debug(f'Found historic for GSP id {gsp_id}')
142+
137143
update_forecast_latest(
138144
forecast=forecast, session=session, forecast_historic=forecast_historic
139145
)

0 commit comments

Comments
 (0)