ab_spot_spec: Frueh-Arbeiter-Log erst lesen, wenn der Arbeiter es angelegt hat (Wettlauf am Mac, 1 von 6 Laeufen rot)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 19:51:13 +01:00
co-authored by Claude Fable 5.2
parent 615936a7ad
commit fdf9bebf92
+6 -1
View File
@@ -267,7 +267,12 @@ log = os.path.join(d, "frueh-arbeiter.jsonl")
m = S.Schatten([sys.executable, ersatz], ziel=log, spielt=True)
m.ab_frueh(frage("FLOP"), "r", "h1") # gilt: Stand des Tisches ist (h1, FLOP)
warte_bis = time.time() + 10
while time.time() < warte_bis and not [x for x in zeilen_von(log) if x.get("frueh")]:
def frueh_zeilen_sobald_da(pfad):
# der Arbeiter legt die Datei erst mit der ersten Zeile an: bis dahin gibt es sie noch nicht (Wettlauf, am Mac sichtbar)
return [x for x in zeilen_von(pfad) if x.get("frueh")] if os.path.exists(pfad) else []
while time.time() < warte_bis and not frueh_zeilen_sobald_da(log):
time.sleep(0.1)
z = [x for x in zeilen_von(log) if x.get("frueh")]
assert len(z) == 1 and z[0]["bahn"] == "ab_b" and z[0]["raum"] == "r" and z[0]["hand"] == "h1" and z[0]["strasse"] == "FLOP", z