computeSaturationStatus method

SaturationStatus computeSaturationStatus(
  1. EvalRunReport report
)

检测当前 report 单次 run 的饱和度。

Implementation

SaturationStatus computeSaturationStatus(EvalRunReport report) {
  final byTask = report.trialsByTask();
  final mature = <String>[];
  final stragglers = <String>[];

  for (final entry in byTask.entries) {
    final passes = entry.value.where((tr) => tr.allGradersPassed).length;
    final total = entry.value.length;
    final passRate = total == 0 ? 0.0 : passes / total;
    if (passRate >= thresholds.matureTaskPassRate) {
      mature.add(entry.key);
    } else if (passRate <= thresholds.brokenTaskPassRate &&
        total >= thresholds.minTrialsForBrokenJudgment) {
      stragglers.add(entry.key);
    }
  }

  final ratio = byTask.isEmpty ? 0.0 : mature.length / byTask.length;
  return SaturationStatus(
    saturatedTaskRatio: ratio,
    suiteSaturated: ratio >= thresholds.saturatedSuiteRatio,
    matureTasks: mature,
    stragglerTasks: stragglers,
  );
}