Gate blocks on a worker started over worker_minutes ago that has not been judged; paid for by trimming wrapped code
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7821c268fa
commit
5e73ccfb4a
6 files changed
+62
-27
No files matched your search
+9
-4
@@ -61,10 +61,8 @@ def age_days():
|
||||
def stale():
|
||||
"""One line when the table is missing or old, else ""."""
|
||||
age = age_days()
|
||||
if age is None:
|
||||
return "sisi: there is no models table yet. " + ASK
|
||||
if age > store.config()["research_days"]:
|
||||
return "sisi: the models table is %d days old. %s" % (age, ASK)
|
||||
if age is None or age > store.config()["research_days"]:
|
||||
return "sisi: " + ("there is no models table yet. " if age is None else "the models table is %d days old. " % age) + ASK
|
||||
return ""
|
||||
|
||||
|
||||
@@ -133,6 +131,13 @@ def claim(s, text, segment=False):
|
||||
return False
|
||||
|
||||
|
||||
def overdue(s):
|
||||
"""Open delegations older than `worker_minutes`: [(worker, its oldest such start)]. A bad or future start is none."""
|
||||
mins, starts = store.config()["worker_minutes"], s.get("starts")
|
||||
old = lambda v: [t for t in v if type(t) in (int, float) and math.isfinite(t) and t <= time.time() - 60 * mins] if isinstance(v, list) else []
|
||||
return [(w, min(old(v))) for w, v in (starts.items() if isinstance(starts, dict) and type(mins) in (int, float) else []) if old(v)]
|
||||
|
||||
|
||||
def out(r, skip, bad, today):
|
||||
"""Why this worker is off the wheel, "" when it is on."""
|
||||
until = [d for d in re.findall(r"out until (\d{4}-\d{2}-\d{2})", " ".join(r).lower()) if d > today]
|
||||
|
||||
Reference in new issue
Block a user