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