Skip to content

Commit

Permalink
Tranlate lark messages (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaotongxiao authored Jul 5, 2023
1 parent 719ba34 commit 986a44c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions opencompass/runners/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import abstractmethod
from typing import Any, Dict, List, Tuple

from mmengine.config import ConfigDict, Config
from mmengine.config import Config, ConfigDict

from opencompass.utils import LarkReporter, get_logger

Expand Down Expand Up @@ -65,16 +65,18 @@ def summarize(self, status: List[Tuple[str, int]]) -> None:
if self.lark_reporter:
num_succeeded = len(status) - len(failed_logs)
if len(failed_logs) > 0:
content = f'{getpass.getuser()} '
content += f'{self.task_cfg.type} 任务已完成,'
content += f'成功任务 {num_succeeded} 个,'
content += f'失败 {len(failed_logs)} 个。以下为失败的任务列表:'
content += '\n' + '\n'.join(failed_logs)
self.lark_reporter.post(title=f'悲报:您有{len(failed_logs)}'
'任务炸了',
content = f'{getpass.getuser()} \'s '
content += f'{self.task_cfg.type} tasks finished. '
content += f'{num_succeeded} tasks succeeded, '
content += f'{len(failed_logs)} tasks failed. Failed tasks are'
content += ':\n' + '\n'.join(failed_logs)
self.lark_reporter.post(title=f'Bad news: {len(failed_logs)} '
'failed.',
content=content)
else:
content = f'{getpass.getuser()} 的 '
content += f'{self.task_cfg.type} 任务已完成,'
content += f'成功任务 {num_succeeded} 个。'
self.lark_reporter.post(title='喜报:全部任务完成', content=content)
content = f'{getpass.getuser()}\'s '
content += f'{self.task_cfg.type} tasks finished. '
content += f'{num_succeeded} tasks succeeded.'
self.lark_reporter.post(title='Great news: all tasks '
'finished!',
content=content)

0 comments on commit 986a44c

Please sign in to comment.