From ea411d2e143a0fe63046118ab9cf2656ec304dac Mon Sep 17 00:00:00 2001 From: Tyler Adam Martinez Date: Fri, 23 Jan 2026 14:36:58 -0600 Subject: [PATCH] [transfers/profiling] Mv guard & logger before list() to prevent crashes --- transfers/profiling.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/transfers/profiling.py b/transfers/profiling.py index a5235724..30259a7c 100644 --- a/transfers/profiling.py +++ b/transfers/profiling.py @@ -20,7 +20,7 @@ from dataclasses import dataclass from datetime import datetime from pathlib import Path -from typing import Callable, Iterable, Any +from typing import Callable, Iterable, Any, Optional from services.gcs_helper import get_storage_bucket from transfers.logger import logger @@ -84,13 +84,14 @@ def run( return result, artifact -def upload_profile_artifacts(artifacts: Iterable[ProfileArtifact]) -> None: +def upload_profile_artifacts(artifacts: Optional[Iterable[ProfileArtifact]]) -> None: """Upload generated profiling artifacts to the configured storage bucket.""" - - artifacts = list(artifacts) if not artifacts: logger.info("No profiling artifacts to upload") return + + artifacts = list(artifacts) + bucket = get_storage_bucket() for artifact in artifacts: for path in (artifact.stats_path, artifact.report_path):