diff --git a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py index 64563278d4c..a6976796560 100644 --- a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py +++ b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_user_services.py @@ -237,9 +237,9 @@ async def progress_create_containers( start_duration = ( scheduler_data.dynamic_sidecar.instrumentation.elapsed_since_start_request() ) - assert start_duration is not None # nosec - get_instrumentation(app).dynamic_sidecar_metrics.start_time_duration.labels( - **get_metrics_labels(scheduler_data) - ).observe(start_duration) + if start_duration is not None: + get_instrumentation(app).dynamic_sidecar_metrics.start_time_duration.labels( + **get_metrics_labels(scheduler_data) + ).observe(start_duration) _logger.info("Internal state after creating user services %s", scheduler_data) diff --git a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py index e861ad9f30c..e3b6d024bf8 100644 --- a/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py +++ b/services/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/_core/_events_utils.py @@ -385,10 +385,10 @@ async def attempt_pod_removal_and_data_saving( stop_duration = ( scheduler_data.dynamic_sidecar.instrumentation.elapsed_since_close_request() ) - assert stop_duration is not None # nosec - get_instrumentation(app).dynamic_sidecar_metrics.stop_time_duration.labels( - **get_metrics_labels(scheduler_data) - ).observe(stop_duration) + if stop_duration is not None: + get_instrumentation(app).dynamic_sidecar_metrics.stop_time_duration.labels( + **get_metrics_labels(scheduler_data) + ).observe(stop_duration) async def attach_project_networks(app: FastAPI, scheduler_data: SchedulerData) -> None: