From 7979353e5414d91bd82ab11d123929cfd3f38d79 Mon Sep 17 00:00:00 2001 From: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> Date: Tue, 2 Dec 2025 16:33:34 +0800 Subject: [PATCH 1/4] add no recusive dir Signed-off-by: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> --- tests/integration/defs/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/defs/pytest.ini b/tests/integration/defs/pytest.ini index 6d6237d5816f..dcca875f034a 100644 --- a/tests/integration/defs/pytest.ini +++ b/tests/integration/defs/pytest.ini @@ -6,7 +6,7 @@ junit_family=legacy addopts = --ignore-glob="*perf/test_perf.py" --ignore-glob="*perf/disagg/*" --ignore-glob="*test_list_validation.py" --ignore-glob="*llm-test-workspace*" --durations=0 -W ignore::DeprecationWarning pythonpath = ../../../examples/auto_deploy -norecursedirs = ./triton/perf +norecursedirs = ./triton/perf ./perf/disagg markers = skip_less_device: skip when less device detected than the declared skip_less_mpi_world_size: skip when less mpi world size detected than the declared From f1e78a8ddb1647ae079ae1fc48d86e2d5b46d61b Mon Sep 17 00:00:00 2001 From: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> Date: Tue, 2 Dec 2025 19:15:04 +0800 Subject: [PATCH 2/4] add a lazy logger instance Signed-off-by: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> --- .../defs/perf/disagg/utils/logger.py | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/tests/integration/defs/perf/disagg/utils/logger.py b/tests/integration/defs/perf/disagg/utils/logger.py index bf7b6808eba8..ccb38b8e73dc 100644 --- a/tests/integration/defs/perf/disagg/utils/logger.py +++ b/tests/integration/defs/perf/disagg/utils/logger.py @@ -103,34 +103,37 @@ def failure(self, msg: str) -> None: self.logger.error(f"[FAILED] {msg}") -# Global logger instance - created immediately when module is imported -logger = DisaggLogger() - - -def setup_logging(output_path: str) -> None: - """Setup logging with output directory. - - Args: - output_path: Output directory path from EnvManager.get_output_path() - """ - logger.setup_file_logging(output_path) - - -# Automatically setup file logging when module is imported -try: - from .common import EnvManager - - output_path = EnvManager.get_output_path() - - # Check if output_path is a valid path (not a placeholder) - if output_path and not output_path.startswith("<"): - setup_logging(output_path) - else: - logger.warning( - f"OUTPUT_PATH not configured (current: '{output_path}'). Logging to console only." - ) - logger.info("Set OUTPUT_PATH environment variable to enable file logging.") -except Exception as e: - # If setup fails (e.g., EnvManager not available, path issues), - # logger will still work with console output only - logger.warning(f"Failed to setup file logging: {e}. Logging to console only.") +# Global logger instance - lazy initialization via proxy class +_logger_instance: Optional[DisaggLogger] = None + + +class LazyLogger: + """Lazy logger proxy that initializes on first access.""" + + def _ensure_logger(self) -> DisaggLogger: + """Ensure logger is initialized and return it.""" + global _logger_instance + if _logger_instance is None: + _logger_instance = DisaggLogger() + # Auto-setup file logging on first access + try: + from .common import EnvManager + output_path = EnvManager.get_output_path() + if output_path and not output_path.startswith("<"): + _logger_instance.setup_file_logging(output_path) + else: + _logger_instance.warning( + f"OUTPUT_PATH not configured (current: '{output_path}'). Logging to console only." + ) + _logger_instance.info("Set OUTPUT_PATH environment variable to enable file logging.") + except Exception as e: + _logger_instance.warning(f"Failed to setup file logging: {e}. Logging to console only.") + return _logger_instance + + def __getattr__(self, name): + """Delegate all attribute access to the real logger.""" + return getattr(self._ensure_logger(), name) + + +# Export lazy logger instance - only initializes when actually used +logger = LazyLogger() From e7fed5516241439abc6bf1815d324d0bb81c81a3 Mon Sep 17 00:00:00 2001 From: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> Date: Tue, 2 Dec 2025 19:15:51 +0800 Subject: [PATCH 3/4] fix Signed-off-by: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> --- tests/integration/defs/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/defs/pytest.ini b/tests/integration/defs/pytest.ini index dcca875f034a..6d6237d5816f 100644 --- a/tests/integration/defs/pytest.ini +++ b/tests/integration/defs/pytest.ini @@ -6,7 +6,7 @@ junit_family=legacy addopts = --ignore-glob="*perf/test_perf.py" --ignore-glob="*perf/disagg/*" --ignore-glob="*test_list_validation.py" --ignore-glob="*llm-test-workspace*" --durations=0 -W ignore::DeprecationWarning pythonpath = ../../../examples/auto_deploy -norecursedirs = ./triton/perf ./perf/disagg +norecursedirs = ./triton/perf markers = skip_less_device: skip when less device detected than the declared skip_less_mpi_world_size: skip when less mpi world size detected than the declared From 8ac761bda81031967d32152cbd96a4589c1d781b Mon Sep 17 00:00:00 2001 From: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> Date: Wed, 3 Dec 2025 09:58:32 +0800 Subject: [PATCH 4/4] fix pre-commit error Signed-off-by: FredricZ-2007 <226039983+fredricz-20070104@users.noreply.github.com> --- tests/integration/defs/perf/disagg/utils/logger.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/integration/defs/perf/disagg/utils/logger.py b/tests/integration/defs/perf/disagg/utils/logger.py index ccb38b8e73dc..cf4018c9b9c6 100644 --- a/tests/integration/defs/perf/disagg/utils/logger.py +++ b/tests/integration/defs/perf/disagg/utils/logger.py @@ -109,7 +109,7 @@ def failure(self, msg: str) -> None: class LazyLogger: """Lazy logger proxy that initializes on first access.""" - + def _ensure_logger(self) -> DisaggLogger: """Ensure logger is initialized and return it.""" global _logger_instance @@ -118,6 +118,7 @@ def _ensure_logger(self) -> DisaggLogger: # Auto-setup file logging on first access try: from .common import EnvManager + output_path = EnvManager.get_output_path() if output_path and not output_path.startswith("<"): _logger_instance.setup_file_logging(output_path) @@ -125,11 +126,15 @@ def _ensure_logger(self) -> DisaggLogger: _logger_instance.warning( f"OUTPUT_PATH not configured (current: '{output_path}'). Logging to console only." ) - _logger_instance.info("Set OUTPUT_PATH environment variable to enable file logging.") + _logger_instance.info( + "Set OUTPUT_PATH environment variable to enable file logging." + ) except Exception as e: - _logger_instance.warning(f"Failed to setup file logging: {e}. Logging to console only.") + _logger_instance.warning( + f"Failed to setup file logging: {e}. Logging to console only." + ) return _logger_instance - + def __getattr__(self, name): """Delegate all attribute access to the real logger.""" return getattr(self._ensure_logger(), name)