Resume a worker one rung up next cycle when it ends its run asking for a higher rung and the judge finds the escalation trigger it cites
This commit is contained in:
@@ -31,7 +31,7 @@ def first_route(anchor: Rung, item: Item | None) -> Route:
|
||||
|
||||
|
||||
def kept(route: Route, anchor: Rung) -> bool:
|
||||
"""Whether a chunk keeps route: its rung is on the ladder at or above item_rung."""
|
||||
"""Whether a chunk keeps route: its rung is on the ladder at or above item_rung, the floor stepped keeps too."""
|
||||
return highest(route.rung, item_rung(anchor, route)) == route.rung
|
||||
|
||||
|
||||
@@ -47,17 +47,26 @@ def escalation_rungs(anchor: Rung, route: Route) -> tuple[Rung, ...]:
|
||||
"""
|
||||
if route.rung not in LADDER:
|
||||
return ()
|
||||
return LADDER[position(route.rung) + 1:position(climbed(item_rung(anchor, route), ESCALATION_CAP)) + 1]
|
||||
return LADDER[position(route.rung) + 1:position(escalation_cap(anchor, route)) + 1]
|
||||
|
||||
|
||||
def stepped(anchor: Rung, route: Route, bundled: int) -> Route:
|
||||
"""The route after one more unfinished verdict; bundled is the highest R + C the judge saw the worker take into the chunk, 0 for none."""
|
||||
# An archived rung since removed from LADDER restarts from the project's rung.
|
||||
rung = route.rung if route.rung in LADDER else anchor
|
||||
def escalation_cap(anchor: Rung, route: Route) -> Rung:
|
||||
"""The highest rung an escalation trigger takes the worker or a task to without the human's yes."""
|
||||
return climbed(item_rung(anchor, route), ESCALATION_CAP)
|
||||
|
||||
|
||||
def stepped(anchor: Rung, route: Route, bundled: int, escalated: bool) -> Route:
|
||||
"""The route after one more unfinished verdict, never on a lower rung or below item_rung.
|
||||
|
||||
bundled is the highest R + C the judge saw the worker take into the chunk, 0 for none; the route climbs to the rung it picks.
|
||||
From there it steps one rung up after every UNFINISHED_PER_STEP unfinished verdicts, or when escalated, as the judge found the escalation trigger the worker cited, up to escalation_cap.
|
||||
"""
|
||||
rung = highest(route.rung, item_rung(anchor, route))
|
||||
rung = highest(rung, picked(anchor, bundled)) if bundled else rung
|
||||
if route.unfinished + 1 >= UNFINISHED_PER_STEP:
|
||||
unfinished = route.unfinished + 1
|
||||
if unfinished >= UNFINISHED_PER_STEP or escalated and position(rung) < position(escalation_cap(anchor, route)):
|
||||
return dataclasses.replace(route, rung=stepped_up(rung), unfinished=0)
|
||||
return dataclasses.replace(route, rung=rung, unfinished=route.unfinished + 1)
|
||||
return dataclasses.replace(route, rung=rung, unfinished=unfinished)
|
||||
|
||||
|
||||
def judge_rung(judge_model: str, route: Route) -> Rung:
|
||||
|
||||
Reference in New Issue
Block a user