From f1542f3ef14787dd64d2653688e5472010a52ab6 Mon Sep 17 00:00:00 2001 From: Daniel Goldstein Date: Tue, 6 Feb 2024 14:52:22 -0500 Subject: [PATCH] [batch] Do not log user errors as exceptions (#14253) The current lack of this guard means we log exceptions when users submit jobs with images that don't exist or when users cancel their jobs (`ContainerDeletedError`). We do this check elsewhere but looks like this line slipped through. --- batch/batch/worker/worker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/batch/batch/worker/worker.py b/batch/batch/worker/worker.py index c265e80564f..5315aa66e1e 100644 --- a/batch/batch/worker/worker.py +++ b/batch/batch/worker/worker.py @@ -1877,8 +1877,9 @@ async def on_completion(): raise except ContainerDeletedError as exc: log.info(f'Container {container} was deleted while running.', exc) - except Exception: - log.exception(f'While running container: {container}') + except Exception as e: + if not user_error(e): + log.exception(f'While running container: {container}') async def run(self): async with self.worker.cpu_sem(self.cpu_in_mcpu):