[Fix] fix log re-direct (#564)

This commit is contained in:
Hubert 2023-11-09 19:34:19 +08:00 committed by GitHub
parent cf5a6d1ab7
commit 889a6b26ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
from mmengine.config import read_base
from opencompass.models.minimax import MiniMax
from opencompass.models import MiniMax
from opencompass.partitioners import NaivePartitioner
from opencompass.runners import LocalRunner
from opencompass.runners.local_api import LocalAPIRunner

View File

@ -4,6 +4,7 @@ import os.path as osp
import subprocess
import sys
import time
import traceback
from multiprocessing import Manager, Pool
from multiprocessing.managers import SyncManager
from typing import Any, Dict, List, Tuple
@ -122,9 +123,13 @@ def launch(task: BaseTask, tokens: SyncManager.Semaphore):
end_time = time.time()
logger.info(f'time elapsed: {end_time - start_time:.2f}s')
except Exception:
# print trace back in target file
traceback.print_exc()
# reset stdout and stderr
reset_std()
logger.warning(f'task {task_name} fail, see\n{out_path}')
returncode = 1
finally:
else:
# reset stdout and stderr
reset_std()
return task_name, returncode