From 3cb79ec3786d5616db6e84f79d0bc50fcf09c596 Mon Sep 17 00:00:00 2001 From: Dan King Date: Fri, 2 Feb 2024 11:11:18 -0500 Subject: [PATCH] [batch] silence instance logs (#14243) `oldwarn` is somehow `None` which spams us with instance log errors. We can revisit the warning level in a PR if this is really important. https://cloudlogging.app.goo.gl/VmUohrJSNo6EjsK56 --- batch/batch/worker/worker.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/batch/batch/worker/worker.py b/batch/batch/worker/worker.py index 64bcf90ac30..c265e80564f 100644 --- a/batch/batch/worker/worker.py +++ b/batch/batch/worker/worker.py @@ -14,7 +14,6 @@ import tempfile import traceback import uuid -import warnings from collections import defaultdict from contextlib import AsyncExitStack, ExitStack from typing import ( @@ -95,19 +94,6 @@ with open('/subdomains.txt', 'r', encoding='utf-8') as subdomains_file: HAIL_SERVICES = [line.rstrip() for line in subdomains_file.readlines()] -oldwarn = warnings.warn - - -def deeper_stack_level_warn(*args, **kwargs): - if 'stacklevel' in kwargs: - kwargs['stacklevel'] = max(kwargs['stacklevel'], 5) - else: - kwargs['stacklevel'] = 5 - return oldwarn(*args, **kwargs) - - -warnings.warn = deeper_stack_level_warn - class BatchWorkerAccessLogger(AccessLogger): def __init__(self, logger: logging.Logger, log_format: str):