Spaces:
Running
Running
File size: 16,163 Bytes
3dfc93b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | """๋ฒ๋ค ๋ค๋ฆฌ (๊ณํ 2026-09-27 L6 ยง2.5 ยท D-L6-2 ยท D-L6-8 ยท D-L6-9).
case ์ ๊ธ **์**์์ hook ์ด ๋ถ๋ฅธ๋ค. ์์:
1. **๋ฐฑํ** โ `BackfillOptions(case=a/c, root=target.projects_dir, mirror_root=blob_mirror_root(), index_root=hub_index_root(),
repo_root=target.repo_root, run_ids=frozenset({run_id}))` โ `backfill_case(opts, target.context)`(wrap โ ๋ฏธ๋ฌ โ ๋ฒ๋ค ์์ธ โ
eval-wrap). `CaseReport.runs` ๋ ์ ํํ ํ๋์ฌ์ผ ํ๋ค(0 ์ด๋ฉด `run_not_in_archive`). ๋ถ๋ฅ โ ์ฝ๋:
wrap `writtenยทreusedยทrewrapped_input_fields` โ ๋ฒ๋ค ์์ ยท `frozen:<c>` โ `bundle_frozen:<c>`(hub ๋ `no_bundle`) ยท
`error:<c>` โ `bundle_error:<c>` ยท ๋ฒ๋ค ์์ธ `error:<c>` โ `bundle_index:<c>`(๊ณ์) ยท eval-wrap `error:*` โ
`eval_wrap:<error_code>`(๊ณ์ โ ๋ฒ๋ค์ ์๋ค) ยท eval-wrap `skip:*`ยท`frozen:*` ๋ ์ ๋ณด ยท `BackfillError` โ `mirror_unadoptable`.
2. **์ฌ์ฑ์ **(๋ฒ๋ค์ด ์์ ๋๋ง) โ lcs_diff ๊ณ์ด(D-L6-8: run.json ์ค๋
์ท `config.evaluator_config.config.type`, ์ค๋
์ท์ด ์์ผ๋ฉด run
๋๋ ํ ๋ฆฌ ํ๊ฐ ํ์ผ์ `poc_bundle.legacy_run.evaluator_family`)์ด๋ฉด `rescore_case(a, c, run_ids={run_id})`(case ๋ชจ๋ ์ฑํ ๊ท์น,
D-L6-9) โ `written|exists` ๊ฐ ok ยท `no_results` skip โ `rescore_empty` ยท ๊ทธ ๋ฐ skip โ `rescore_skip:<code>` ยท ์ค๋ฅ โ
`rescore_error:<code>`. ๊ณ์ด์ด ์๋๋ฉด `not_proofread_family`(์ ๋ณด โ "์ด ํ๊ฐ๊ธฐ๋ M2 ์ฑ์ ๋ฒ๋ค ์์ฐ์๊ฐ ์๋ค", Q-M2-1).
3. **์์ธ** โ `indexes.refresh`(lockยทํ
ํ๋ฆฟยทํ
์คํธ ๋ชจ๋ยท์ถ์ถ๊ธฐยท์์ธ ์ฝ๋ ํค๊ฐ ๋ฐ๋์์ ๋๋ง, D-L6-7).
๋ค๋ฆฌ ๊ฒฐ๊ณผ๋ ํ๋์ `LegResult` ๋ค. ์คํจ๊ฐ ์ฌ๋ฟ์ด๋ฉด **์์์ ์ฒซ ์คํจ**๊ฐ `code` ์ด๊ณ , ๋จ๊ณ๋ง๋ค์ ๊ฒฐ๊ณผ๋ `detail` ์ ๋ชจ๋ ๋จ๋๋ค
(์ํ ํ์ผ ยง2.7): `{"backfill": run_entry, "rescore": {"status", "code"?, "bundle_id"?}, "indexes": <์ฝ๋>}`. ๋ฒ๋ค์ด ์์ผ๋ฉด ์คํจ์ฌ๋
`detail.backfill.wrap` ์ด ๋จ์ hook ์ด `types.bundle_ready` ๋ก hub ๋ค๋ฆฌ๋ฅผ ๋๋ค(D-L6-2). ์์ธ CLI ์ ์ ํฉ์ฑ ๊ฒฝ๊ณ ๊ฐ ์์ผ๋ฉด
`index_warnings: <๊ฑด์>`, ์น์ด ์ ์์ธ ๋๋ ํ ๋ฆฌ๊ฐ ์์ผ๋ฉด `index_removed: [<์ด๋ฆ>โฆ]` ๋ฅผ ๋ํ๋ค(๋ฆฌ๋ทฐ ์ง์ 2ยท4 โ ์ค ์์ฒด๋
`indexes` ๊ฐ stderr ๋ก ๋ธ๋ค).
**๋จ๊ณ ์์ธ ๋ด์.** ์ฌ์ฑ์ ยท์์ธ ๋จ๊ณ์ ์๊ธฐ์น ์์ ์์ธ๋ ๊ทธ ๋จ๊ณ๋ง `rescore_exception:<Type>`ยท`indexes_exception:<Type>` ์คํจ๋ก
๊ฐ๋ฑํ๋ค(ํ์
์ด๋ฆ๋ง) โ ๋ฐฑํ์ด ๋ง๋ ๋ฒ๋ค์ ๋ฒ๋ฆฌ์ง ์๊ณ hub ๋ค๋ฆฌ๊น์ง ๊ฐ๊ฒ. ๋ฐฑํ ์์ฒด์ ์์ธ๋ hook ์ด `bundle_exception:<Type>`
์ผ๋ก ๊ฐ๋ฑํ๋ค(๋ฒ๋ค ์ ๋ฌด๋ฅผ ๋ชจ๋ฅธ๋ค). ์๋ฌธยทlocals ๋ ์ฃ์ง ์์ง๋ง **๋ฐ์ ์์น**๋ ๋จ๊ธด๋ค(๋ฆฌ๋ทฐ ์ง์ 5): ๊ฐ์ฅ ์์ชฝ ํ๋ ์์
`<ํ์ผ basename>:<์ค>:<ํจ์>` ๋ฅผ `detail.exception_at.<๋จ๊ณ>` ์(๊ณ ๊ฐ ๋ฐ์ดํฐ๊ฐ ์๋ ์ฝ๋ ์ขํ), ํธ๋ ์ด์ค๋ฐฑ ์ ์ฒด๋ ์ด ๋ชจ๋ ๋ก๊ฑฐ์
(`hook` ๊ณผ ๊ฐ์ ๊ท์น โ ๊ธฐ๋ณธ DEBUG, `SOLAR_EVAL_HOOK_DEBUG=1` ์ด๋ฉด WARNING).
`poc_bundle`ยท`solar_eval.rescore` ๋ ํจ์ ์์์๋ง import ํ๋ค(D-L6-14). ์ถ๋ ฅยทdetail ์๋ idยท๋ถ๋ฅยท์ฝ๋๋ง(๊ณ ๊ฐ ํ
์คํธ ์์).
"""
from __future__ import annotations
import logging
import traceback
from collections.abc import Mapping
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
from solar_eval.hub_hook import indexes, optin, target
from solar_eval.hub_hook.types import (
BUNDLE_ERROR_PREFIX,
BUNDLE_FROZEN_PREFIX,
BUNDLE_INDEX_FAILED_PREFIX,
EVAL_WRAP_FAILED_PREFIX,
MIRROR_UNADOPTABLE,
NO_BUNDLE,
NOT_PROOFREAD_FAMILY,
PROOFREAD_EVALUATOR_TYPE,
RESCORE_EMPTY,
RESCORE_ERROR_PREFIX,
RESCORE_NO_RESULTS,
RESCORE_OK,
RESCORE_SKIP_PREFIX,
RUN_NOT_IN_ARCHIVE,
STATUS_FAILED,
STATUS_NOT_RUN,
STATUS_SKIPPED,
STEP_BACKFILL,
STEP_INDEXES,
STEP_RESCORE,
WRAP_BUNDLE_READY,
WRAP_ERROR_PREFIX,
WRAP_FROZEN_PREFIX,
LegResult,
Target,
exception_code,
)
_RUN_JSON = "run.json"
_LOG = logging.getLogger(__name__)
# detail ํค `index_warnings`ยท`index_removed`ยท`exception_at`(๋ฆฌ๋ทฐ ์ง์ 2ยท4ยท5)๋ ์ฝ๋ ๋ชจ์ ๋ฌธ์์ด์ด๋ผ ์ด ๋ชจ๋ ์ต์์ ์์๋ก ๋์ง
# ์๋๋ค(`test_types_home` โ ์ฝ๋ ๋ฌธ์์ด์ `types.py` ํ ๊ณณ). ์ฐ๋ ์๋ฆฌ์ ํ ๋ฒ์ฉ๋ง ์ ์๋ค โ l6a-verify ๊ฐ `types.py` ๋ก ์ฎ๊ธด๋ค
# (๊ณํ ยง2.5 ๊ตฌํ ์ ๋ณ๊ฒฝ ๋ฉ๋ชจ).
@dataclass(frozen=True)
class _Backfilled:
"""๋ฐฑํ ๊ฒฐ๊ณผ โ `entry` ๋ ๋ณด๊ณ ์ `run_entry`(์์ผ๋ฉด run ์ด ์๊ฑฐ๋ case ์ค๋ฅ), `failures` ๋ ์์๋๋ก์ ์คํจ ์ฝ๋."""
entry: Mapping[str, Any] | None
run_id: str | None = None
bundle_id: str | None = None
failures: tuple[str, ...] = ()
@property
def ready(self) -> bool:
return self.entry is not None and self.entry.get("wrap") in WRAP_BUNDLE_READY
@dataclass
class _Steps:
"""๋ค๋ฆฌ ์ ๋จ๊ณ๋ค์ ๊ฒฐ๊ณผ โ ์ฒซ ์คํจ์ ๊ทธ hint ๋ฅผ ๋ชจ์๋ค."""
detail: dict[str, Any] = field(default_factory=dict)
failures: list[str] = field(default_factory=list)
hint: str | None = None
def fail(self, code: str, hint: str | None = None) -> None:
if not self.failures:
self.hint = hint
self.failures.append(code)
def result(self) -> LegResult:
if self.failures:
return LegResult.failed(self.failures[0], self.hint, self.detail)
return LegResult.ok(self.detail)
def contain(self, step: str, exc: Exception) -> str:
"""๋จ๊ณ ์์ธ โ ์ฝ๋(ํ์
์ด๋ฆ๋ง). ์์น ์ขํ๋ detail ์, ํธ๋ ์ด์ค๋ฐฑ์ ๋ก๊ฑฐ๋ก(๋ชจ๋ ์ค๋ช
ยท ๋ฆฌ๋ทฐ ์ง์ 5)."""
code = exception_code(step, exc)
where = exception_location(exc)
if where is not None:
self.detail.setdefault("exception_at", {})[step] = where
level = logging.WARNING if optin.hook_debug_requested() else logging.DEBUG
_LOG.log(level, "Experiment Hub ํ
๋ฒ๋ค ๋ค๋ฆฌ ๋จ๊ณ ์์ธ ๋ด์ โ %s", code, exc_info=exc)
return code
def exception_location(exc: BaseException) -> str | None:
"""๊ฐ์ฅ ์์ชฝ ํ๋ ์์ `<ํ์ผ basename>:<์ค>:<ํจ์>` โ ๋ฉ์์งยทlocals ๋ ์ฃ์ง ์๋๋ค(๊ณ ๊ฐ ๋ฐ์ดํฐ๊ฐ ์๋ ์ฝ๋ ์ขํ๋ง)."""
frames = traceback.extract_tb(exc.__traceback__)
if not frames:
return None
last = frames[-1]
return f"{Path(last.filename).name}:{last.lineno}:{last.name}"
def run_bundle_leg(target: Target, run_dir: Path, run_id: str) -> LegResult:
"""run ํ๋์ ๋ฐฑํ โ ์ฌ์ฑ์ โ ์์ธ(ยง2.5). ๋ฐฑํ ์์ธ๋ hook ์ด `bundle_exception:<Type>` ์ผ๋ก ๊ฐ๋ฑํ๋ค."""
backfilled = _backfill(target, run_id)
if backfilled.entry is None:
return LegResult.failed(backfilled.failures[0])
steps = _Steps({STEP_BACKFILL: dict(backfilled.entry)})
for code in backfilled.failures:
steps.fail(code)
if backfilled.ready:
_rescore_step(target, Path(run_dir), backfilled, steps)
else:
steps.detail[STEP_RESCORE] = {"status": STATUS_NOT_RUN, "code": NO_BUNDLE}
_indexes_step(target, steps)
return steps.result()
def ensure_run_bundle(target: Target, run_id: str) -> tuple[LegResult, Path | None]:
"""๋ฐฑํ ๋ถ๋ถ๋ง(L6b `runs eval` ์ ๊ฒฝ๋ก โ ) โ ์ฑํ๋ ๋ฏธ๋ฌ run ๋ฒ๋ค ๊ฒฝ๋ก๋ฅผ ํจ๊ป ๋๋ ค์ค๋ค. ๋ฒ๋ค์ด ์์ผ๋ฉด None.
**์ ์ : ํธ์ถ์๊ฐ `lock.case_lock(target.account, target.case)` ๋ฅผ ์ฅ ์ฑ ๋ถ๋ฅธ๋ค**(๊ณํ ยง2.12 B4 "new_path (case ์ ๊ธ ์)" ยท
๋ฆฌ๋ทฐ ์ง์ 6) โ ๋ฐฑํ์ ๋ฏธ๋ฌยท๋ฒ๋ค ์์ธ ์ฌ์ด๋์นดยทeval-wrap ์ ์ฐ๋ฏ๋ก ๊ฐ์ case ์ ํ
๊ณผ ๊ฒน์น๋ฉด ์ ๋๋ค. ์ฌ๊ธฐ์ ์ ๊ทธ์ง ์๋
๊น๋ญ: L6b ๋ โ ~โค(๋ฒ๋ค ํ์ธยท์ฑ์ ยท๋ฐํยทhubยท์ํ ํ์ผ)๋ฅผ ํ ์ ๊ธ ์์์ ๋๋ค โ `flock` ์ ๊ฐ์ ํ๋ก์ธ์ค๋ผ๋ ๋ฐ๋ก ์ฐ ๊ธฐ์ ์๋ผ๋ฆฌ
๋ง์ผ๋ฏ๋ก ์์์ ๋ค์ ์ก์ผ๋ฉด ์๊ธฐ ์์ ์ ๊ธฐ๋ค๋ฆฌ๋ค ํ๋์ ๊ฑธ๋ฆฐ๋ค.
ํ์ ์งํฉ์ `run_bundle_leg` ์ ๊ฐ๋ค(`WRAP_BUNDLE_READY`) โ ํ
์์ ํต๊ณผํ run ์ด ์ฌ๊ธฐ์ ์คํจํ์ง ์๊ฒ(๊ฒํ F12).
eval-wrapยท๋ฒ๋ค ์์ธ ์คํจ๋ `run_bundle_leg` ์ฒ๋ผ ์คํจ๋ก ์ฃ๋ ๊ฒฝ๋ก๋ ๋๋ ค์ค๋ค(๋ฒ๋ค์ ์๋ค).
"""
backfilled = _backfill(target, run_id)
if backfilled.entry is None:
return LegResult.failed(backfilled.failures[0]), None
detail = {STEP_BACKFILL: dict(backfilled.entry)}
path = _mirror_bundle_path(target, backfilled.bundle_id) if backfilled.ready else None
if backfilled.failures:
return LegResult.failed(backfilled.failures[0], detail=detail), path
return LegResult.ok(detail), path
# โโ ๋ฐฑํ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
def _backfill(target: Target, run_id: str) -> _Backfilled:
"""`backfill_case` ๋ฅผ run ํ๋๋ก. ์ถฉ๋ ๊ฒ์ฌ๋ PB ๊ฐ case ์ run ๋๋ ํ ๋ฆฌ ์ ๋ถ๋ก ํ๋ค."""
from poc_bundle.backfill.report import run_entry
from poc_bundle.backfill.runner import BackfillError, BackfillOptions, backfill_case
from poc_bundle.home import blob_mirror_root, hub_index_root
opts = BackfillOptions(
case=target.case_ref,
root=target.projects_dir,
mirror_root=blob_mirror_root(),
index_root=hub_index_root(),
repo_root=target.repo_root,
run_ids=frozenset({run_id}),
)
try:
report = backfill_case(opts, target.context)
except BackfillError:
return _Backfilled(None, failures=(MIRROR_UNADOPTABLE,))
if not report.runs:
return _Backfilled(None, failures=(RUN_NOT_IN_ARCHIVE,))
if len(report.runs) != 1:
raise RuntimeError(f"backfill returned {len(report.runs)} runs for one run directory")
run = report.runs[0]
return _Backfilled(run_entry(run), run.run_id, run.bundle_id, _backfill_failures(run))
def _backfill_failures(run: Any) -> tuple[str, ...]:
"""`RunReport` ๋ถ๋ฅ โ ๋ฒ๋ค ๋ค๋ฆฌ ์คํจ ์ฝ๋(์์: ์ด๋ํฐยทwrap โ ๋ฒ๋ค ์์ธ โ eval-wrap)."""
failures: list[str] = []
wrap_failure = _wrap_failure(run.adapter, run.wrap)
if wrap_failure is not None:
failures.append(wrap_failure)
if isinstance(run.index, str) and run.index.startswith(WRAP_ERROR_PREFIX):
failures.append(f"{BUNDLE_INDEX_FAILED_PREFIX}{run.index.removeprefix(WRAP_ERROR_PREFIX)}")
if isinstance(run.eval_wrap, str) and run.eval_wrap.startswith(WRAP_ERROR_PREFIX):
detail = run.error_code or run.eval_wrap.removeprefix(WRAP_ERROR_PREFIX)
failures.append(f"{EVAL_WRAP_FAILED_PREFIX}{detail}")
return tuple(failures)
def _wrap_failure(adapter: str | None, wrap: str | None) -> str | None:
"""wrap ์ด ๋ฒ๋ค์ ๋จ๊ธฐ์ง ๋ชปํ์ผ๋ฉด ๊ทธ ์ฝ๋. ์ด๋ํฐ๊ฐ ๋ง์ wrap ์ ๋ฟ์ง ์์์ผ๋ฉด ์ด๋ํฐ ๋ถ๋ฅ๋ก."""
if wrap in WRAP_BUNDLE_READY:
return None
if isinstance(wrap, str) and wrap.startswith(WRAP_FROZEN_PREFIX):
return f"{BUNDLE_FROZEN_PREFIX}{wrap.removeprefix(WRAP_FROZEN_PREFIX)}"
stage = wrap if isinstance(wrap, str) else adapter
if isinstance(stage, str) and stage.startswith(WRAP_ERROR_PREFIX):
return f"{BUNDLE_ERROR_PREFIX}{stage.removeprefix(WRAP_ERROR_PREFIX)}"
return f"{BUNDLE_ERROR_PREFIX}{stage or 'none'}"
def _mirror_bundle_path(t: Target, bundle_id: str | None) -> Path | None:
"""๋ฏธ๋ฌ์ `accounts/<a>/<c>/eval/bundles/<bundle_id>`(์์ ๋๋ง)."""
from solar_eval.rescore.paths import BUNDLES_AREA, mirror_area_dir
if not bundle_id:
return None
path = mirror_area_dir(None, t.account, t.case, BUNDLES_AREA) / bundle_id
return path if path.is_dir() else None
# โโ ์ฌ์ฑ์ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
def _rescore_step(t: Target, run_dir: Path, backfilled: _Backfilled, steps: _Steps) -> None:
try:
if not is_proofread_family(run_dir):
steps.detail[STEP_RESCORE] = {"status": STATUS_SKIPPED, "code": NOT_PROOFREAD_FAMILY}
return
status, code, bundle_id = _rescore(t, backfilled.run_id or run_dir.name)
except Exception as exc: # ๋จ๊ณ ๊ฒฝ๊ณ โ ๋ฐฑํ์ด ๋ง๋ ๋ฒ๋ค๋ก hub ๋ค๋ฆฌ๋ ๊ณ์ ๊ฐ๋ค(๋ชจ๋ ์ค๋ช
)
status, code, bundle_id = STATUS_FAILED, steps.contain(STEP_RESCORE, exc), None
entry: dict[str, Any] = {"status": status}
if code is not None:
entry["code"] = code
if bundle_id is not None:
entry["bundle_id"] = bundle_id
steps.detail[STEP_RESCORE] = entry
if status == STATUS_FAILED and code is not None:
steps.fail(code)
def is_proofread_family(run_dir: Path) -> bool:
"""์ฌ์ฑ์ ๋์์ธ๊ฐ(D-L6-8). ์ค๋
์ท ํ๊ฐ๊ธฐ type ์ด ์์ผ๋ฉด ๊ทธ๊ฒ, ์์ผ๋ฉด run ๋๋ ํ ๋ฆฌ ํ๊ฐ ํ์ผ์ ๊ณ์ด(๊ฒํ F18).
run.jsonยทํ๊ฐ ํ์ผ์ ๋ชป ์ฝ์ผ๋ฉด ๊ณ์ด์ ๋ชจ๋ฅด๋ฏ๋ก ๋์์ด ์๋๋ค(`not_proofread_family` โ wrap ์ด ๊ทธ run ์ ์ด๋ฏธ ๊ฐ๋ฅธ๋ค).
"""
from poc_bundle.canonical import load_json_strict
from poc_bundle.legacy_run import (
FAMILY_LCS,
LegacyRunError,
evaluator_family,
read_eval_files,
split_rounds,
)
try:
run_json = load_json_strict((Path(run_dir) / _RUN_JSON).read_bytes(), safe_integers=False)
except (OSError, ValueError, RecursionError):
return False
if not isinstance(run_json, dict):
return False
kind = target.snapshot_evaluator_type(run_json)
if kind is not None:
return kind == PROOFREAD_EVALUATOR_TYPE
try:
evaluation, lines = read_eval_files(Path(run_dir))
except LegacyRunError:
return False
return evaluator_family(run_json, evaluation, split_rounds(evaluation, lines)) == FAMILY_LCS
def _rescore(t: Target, run_id: str) -> tuple[str, str | None, str | None]:
"""`rescore_case(run_ids={run_id})` โ (์ํ, ์ฝ๋, ์ฑ์ ๋ฒ๋ค id). ์ํ๋ `written|exists`(ok) ๋๋ `failed`."""
from poc_bundle.home import blob_mirror_root
from solar_eval.rescore.case import rescore_case
summary = rescore_case(
t.account,
t.case,
mirror_root=blob_mirror_root(),
repo_root=t.repo_root,
run_ids=frozenset({run_id}),
)
if summary.failures:
return STATUS_FAILED, f"{RESCORE_ERROR_PREFIX}{summary.failures[0].code}", None
if len(summary.outcomes) != 1:
return STATUS_FAILED, RESCORE_EMPTY, None
outcome = summary.outcomes[0]
if outcome.status in RESCORE_OK:
bundle_id = None if outcome.path is None else Path(outcome.path).name
return outcome.status, None, bundle_id
if outcome.code == RESCORE_NO_RESULTS:
return STATUS_FAILED, RESCORE_EMPTY, None
return STATUS_FAILED, f"{RESCORE_SKIP_PREFIX}{outcome.code}", None
# โโ ์์ธ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
def _indexes_step(t: Target, steps: _Steps) -> None:
try:
outcome = indexes.refresh(t)
except Exception as exc: # ๋จ๊ณ ๊ฒฝ๊ณ โ ์์ธ์ case ํ์๋ฌผ์ด๋ผ run ๋ฒ๋คยทhub ๋ค๋ฆฌ๋ฅผ ๋ง์ง ์๋๋ค
code = steps.contain(STEP_INDEXES, exc)
steps.detail[STEP_INDEXES] = f"{STATUS_FAILED}:{code}"
steps.fail(code)
return
steps.detail[STEP_INDEXES] = outcome.code
if outcome.warnings:
steps.detail["index_warnings"] = len(outcome.warnings)
if outcome.removed:
steps.detail["index_removed"] = list(outcome.removed)
if outcome.failed:
steps.fail(outcome.code.removeprefix(f"{STATUS_FAILED}:"), outcome.reason)
__all__ = ["ensure_run_bundle", "is_proofread_family", "run_bundle_leg"]
|