From 526ddb886d2f01e9482c69face7550fb052e4ad2 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Mon, 12 May 2025 14:18:42 -0400 Subject: [PATCH] guard on deleting secrets from env (#2653) [skip ci] --- .runpod/src/handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.runpod/src/handler.py b/.runpod/src/handler.py index 21073dff4..740c1ed1f 100644 --- a/.runpod/src/handler.py +++ b/.runpod/src/handler.py @@ -57,8 +57,10 @@ async def handler(job): logger.info("Training Complete.") # Cleanup - del os.environ["WANDB_API_KEY"] - del os.environ["HF_TOKEN"] + if "WANDB_API_KEY" in os.environ: + del os.environ["WANDB_API_KEY"] + if "HF_TOKEN" in os.environ: + del os.environ["HF_TOKEN"] runpod.serverless.start({"handler": handler, "return_aggregate_stream": True})