| 500 | __var__: ClassVar[ContextVar[Self]] = ContextVar("flow_run") |
| 501 | |
| 502 | def serialize(self: Self, include_secrets: bool = True) -> dict[str, Any]: |
| 503 | serialized = self.model_dump( |
| 504 | include={ |
| 505 | "flow_run", |
| 506 | "flow", |
| 507 | "parameters", |
| 508 | "log_prints", |
| 509 | "start_time", |
| 510 | "input_keyset", |
| 511 | "persist_result", |
| 512 | }, |
| 513 | exclude_unset=True, |
| 514 | context={"include_secrets": include_secrets}, |
| 515 | ) |
| 516 | if self.result_store: |
| 517 | serialized["result_store"] = self.result_store.model_dump( |
| 518 | serialize_as_any=True, |
| 519 | exclude_unset=True, |
| 520 | context={"include_secrets": include_secrets}, |
| 521 | ) |
| 522 | return serialized |
| 523 | |
| 524 | |
| 525 | FlowRunContext = EngineContext # for backwards compatibility |