MCPcopy Create free account
hub / github.com/InternScience/SciReason / summarize

Method summarize

opencompass/runners/base.py:54–84  ·  view source on GitHub ↗

Summarize the results of the tasks. Args: status (list[tuple[str, int]]): A list of (task name, exit code).

(self, status: List[Tuple[str, int]])

Source from the content-addressed store, hash-verified

52 """
53
54 def summarize(self, status: List[Tuple[str, int]]) -> None:
55 """Summarize the results of the tasks.
56
57 Args:
58 status (list[tuple[str, int]]): A list of (task name, exit code).
59 """
60
61 failed_logs = []
62 for _task, code in status:
63 if code != 0:
64 get_logger().error(f'{_task} failed with code {code}')
65 failed_logs.append(_task)
66 if self.lark_reporter:
67 num_succeeded = len(status) - len(failed_logs)
68 if len(failed_logs) > 0:
69 content = f'{getpass.getuser()} \'s '
70 content += f'{self.task_cfg.type} tasks finished. '
71 content += f'{num_succeeded} tasks succeeded, '
72 content += f'{len(failed_logs)} tasks failed. Failed tasks are'
73 content += ':\n' + '\n'.join(failed_logs)
74 self.lark_reporter.post(title=f'Bad news: {len(failed_logs)} '
75 'failed.',
76 content=content)
77 else:
78 content = f'{getpass.getuser()}\'s '
79 content += f'{self.task_cfg.type} tasks finished. '
80 content += f'{num_succeeded} tasks succeeded.\n'
81 content += '\n'.join([task for task, _ in status])
82 self.lark_reporter.post(title='Great news: all tasks '
83 'finished!',
84 content=content)

Callers 3

__call__Method · 0.95
mainFunction · 0.45
mainFunction · 0.45

Calls 2

get_loggerFunction · 0.90
postMethod · 0.80

Tested by

no test coverage detected