Skip to content

Commit

Permalink
[batch] silence instance logs (#14243)
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
danking authored Feb 2, 2024
1 parent dace919 commit 3cb79ec
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions batch/batch/worker/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import tempfile
import traceback
import uuid
import warnings
from collections import defaultdict
from contextlib import AsyncExitStack, ExitStack
from typing import (
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 3cb79ec

Please sign in to comment.