From 7801b47bf372b17cc29724903ec622c413974bf4 Mon Sep 17 00:00:00 2001 From: ChengjieLi Date: Thu, 7 Nov 2024 15:34:01 +0800 Subject: [PATCH] fix --- xinference/conftest.py | 8 -------- xinference/deploy/cmdline.py | 5 +++++ xinference/deploy/utils.py | 11 +++++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xinference/conftest.py b/xinference/conftest.py index 7a05a09a7e..675253e5d1 100644 --- a/xinference/conftest.py +++ b/xinference/conftest.py @@ -58,10 +58,6 @@ "propagate": False, } }, - "root": { - "level": "WARN", - "handlers": ["stream_handler"], - }, } TEST_LOG_FILE_PATH = get_log_file(f"test_{get_timestamp_ms()}") @@ -102,10 +98,6 @@ "propagate": False, } }, - "root": { - "level": "WARN", - "handlers": ["stream_handler", "file_handler"], - }, } diff --git a/xinference/deploy/cmdline.py b/xinference/deploy/cmdline.py index f0f09720a5..97db2a0def 100644 --- a/xinference/deploy/cmdline.py +++ b/xinference/deploy/cmdline.py @@ -43,6 +43,7 @@ get_log_file, get_timestamp_ms, handle_click_args_type, + set_envs, ) try: @@ -106,6 +107,8 @@ def start_local_cluster( XINFERENCE_LOG_MAX_BYTES, ) logging.config.dictConfig(dict_config) # type: ignore + # refer to https://huggingface.co/docs/transformers/main_classes/logging + set_envs("TRANSFORMERS_VERBOSITY", log_level.lower()) main( host=host, @@ -280,6 +283,7 @@ def supervisor( XINFERENCE_LOG_MAX_BYTES, ) logging.config.dictConfig(dict_config) # type: ignore + set_envs("TRANSFORMERS_VERBOSITY", log_level.lower()) main( host=host, @@ -342,6 +346,7 @@ def worker( XINFERENCE_LOG_MAX_BYTES, ) logging.config.dictConfig(dict_config) # type: ignore + set_envs("TRANSFORMERS_VERBOSITY", log_level.lower()) endpoint = get_endpoint(endpoint) diff --git a/xinference/deploy/utils.py b/xinference/deploy/utils.py index 1a8603bb6f..bea7f14339 100644 --- a/xinference/deploy/utils.py +++ b/xinference/deploy/utils.py @@ -134,10 +134,6 @@ def get_config_dict( "propagate": False, }, }, - "root": { - "level": "WARN", - "handlers": ["stream_handler", "file_handler"], - }, } return config_dict @@ -220,3 +216,10 @@ def handle_click_args_type(arg: str) -> Any: pass return arg + + +def set_envs(key: str, value: str): + """ + Environment variables are set by the parent process and inherited by child processes + """ + os.environ[key] = value