From 761f8fdc0139967eadd14ed26a0491868ab0bef2 Mon Sep 17 00:00:00 2001 From: Tanny Chavez Date: Thu, 13 Feb 2025 14:30:33 -0800 Subject: [PATCH] Add warning when prefect is not available --- mlex_utils/dash_utils/callbacks/manage_jobs.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mlex_utils/dash_utils/callbacks/manage_jobs.py b/mlex_utils/dash_utils/callbacks/manage_jobs.py index 5406b4c..4e9e895 100644 --- a/mlex_utils/dash_utils/callbacks/manage_jobs.py +++ b/mlex_utils/dash_utils/callbacks/manage_jobs.py @@ -1,3 +1,5 @@ +import logging + from dash import html, no_update from mlex_utils.prefect_utils.core import ( @@ -16,11 +18,18 @@ ] +logger = logging.getLogger(__name__) + + def _check_job(prefect_tags, mode): if mode == "dev": data = DEV_JOBS else: - data = query_flow_runs(tags=prefect_tags) + try: + data = query_flow_runs(tags=prefect_tags) + except Exception as e: + logger.warning(f"Failed to query flow runs: {e}") + data = [] return data