Unverified Commit 85cff748 authored by Ivanfangsc's avatar Ivanfangsc Committed by GitHub
Browse files

Fix on log and metric issue on Windows when using pytorch with multithread (#3604)


Co-authored-by: default avatarveraku <shuchengfang@outlook.com>
parent e878e720
......@@ -88,7 +88,7 @@ def _init_logger_dispatcher() -> None:
def _init_logger_trial() -> None:
log_path = _prepare_log_dir(trial_env_vars.NNI_OUTPUT_DIR) / 'trial.log'
log_file = open(log_path, 'w')
log_file = open(log_path, 'a')
_register_handler(StreamHandler(log_file), logging.INFO)
if trial_env_vars.NNI_PLATFORM == 'local':
......
......@@ -13,7 +13,7 @@ from nni.utils import to_json
_sysdir = trial_env_vars.NNI_SYS_DIR
if not os.path.exists(os.path.join(_sysdir, '.nni')):
os.makedirs(os.path.join(_sysdir, '.nni'))
_metric_file = open(os.path.join(_sysdir, '.nni', 'metrics'), 'wb')
_metric_file = open(os.path.join(_sysdir, '.nni', 'metrics'), 'ab')
_outputdir = trial_env_vars.NNI_OUTPUT_DIR
if not os.path.exists(_outputdir):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment