Skip to content

Commit 5f0e45b

Browse files
committed
Skip microgrid if no data is available during workflow
Instantiate `NoDataAvailableError` for logging when a microgrid returns an empty DataFrame, and continue with the next microgrid to prevent workflow interruption. Signed-off-by: cyiallou - Costas <[email protected]>
1 parent 3bd8a4b commit 5f0e45b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/frequenz/lib/notebooks/solar/maintenance/solar_maintenance_app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ async def run_workflow(user_config_changes: dict[str, Any]) -> SolarAnalysisData
293293
reporting_data_higher_fs, col_text, verbose=config.verbose
294294
)
295295
normalisation_factor = 1
296+
if data.empty:
297+
reason = NoDataAvailableError(f"No data available for microgrid ID {mid}.")
298+
print(f"{type(reason).__name__}: {reason} Skipping...")
299+
continue
296300
timezone = str(pd.to_datetime(data.index).tzinfo)
297301
if timezone != config.time_zone.key:
298302
raise ValueError("Timezone mismatch.")

0 commit comments

Comments
 (0)