Append a log entry to the run log. Held under ``_log_lock`` so concurrent fan-out workers serialize their list append and ``log.jsonl`` write rather than interleaving lines.
(self, entry: dict[str, Any])
| 547 | return state |
| 548 | |
| 549 | def append_log(self, entry: dict[str, Any]) -> None: |
| 550 | """Append a log entry to the run log. |
| 551 | |
| 552 | Held under ``_log_lock`` so concurrent fan-out workers serialize their |
| 553 | list append and ``log.jsonl`` write rather than interleaving lines. |
| 554 | """ |
| 555 | entry["timestamp"] = datetime.now(timezone.utc).isoformat() |
| 556 | runs_dir = self.runs_dir |
| 557 | runs_dir.mkdir(parents=True, exist_ok=True) |
| 558 | with self._log_lock: |
| 559 | self.log_entries.append(entry) |
| 560 | with open(runs_dir / "log.jsonl", "a", encoding="utf-8") as f: |
| 561 | f.write(json.dumps(entry) + "\n") |
| 562 | |
| 563 | |
| 564 | # -- Workflow Engine ------------------------------------------------------ |
no outgoing calls