tau2: module-level silencing (order-independent)

Function-level silencers kept losing the race to whichever 'import
tau2.*' fired first in the process. The filter + TAU2_DATA_DIR now
install when the env registry loads the plugin, strictly before any
tau2 import can happen anywhere.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-17 09:21:16 +00:00
parent a69cea2b76
commit 15b1574857

View File

@ -18,6 +18,25 @@ from typing import Any, Dict, List, Optional
from ...data.sample import ChatMessage, Sample from ...data.sample import ChatMessage, Sample
from ..loop import Environment, register_env from ..loop import Environment, register_env
# ---- module-level, order-independent tau2 silencing --------------------
# Every function-level silencer proved fragile to import order (banners
# fire at 'import tau2.*' wherever it first happens in the process).
# This block runs when the ENV_REGISTRY loads this plugin -- strictly
# before any tau2 import anywhere -- and is therefore the one that counts.
import os as _os
import sys as _sys
_os.environ.setdefault('TAU2_DATA_DIR',
'/data1/sora/evalscope/tools/tau2-bench/data')
try:
from loguru import logger as _lg
_lg.remove()
_lg.add(_sys.stderr, level='ERROR')
except Exception:
pass
# ------------------------------------------------------------------------
_PATCHED = False _PATCHED = False