Runs evaluation of ParseGraph.
| 37 | |
| 38 | |
| 39 | class GraphRunner: |
| 40 | """Runs evaluation of ParseGraph.""" |
| 41 | |
| 42 | _graph: graph.ParseGraph |
| 43 | debug: bool |
| 44 | ignore_asserts: bool |
| 45 | runtime_typechecking: bool |
| 46 | terminate_on_error: bool |
| 47 | event_loop: asyncio.AbstractEventLoop | None = None |
| 48 | |
| 49 | def __init__( |
| 50 | self, |
| 51 | input_graph: graph.ParseGraph, |
| 52 | *, |
| 53 | debug: bool = False, |
| 54 | ignore_asserts: bool | None = None, |
| 55 | monitoring_level: MonitoringLevel = MonitoringLevel.AUTO, |
| 56 | with_http_server: bool = False, |
| 57 | default_logging: bool = True, |
| 58 | persistence_config: PersistenceConfig | None = None, |
| 59 | runtime_typechecking: bool | None = None, |
| 60 | terminate_on_error: bool | None = None, |
| 61 | max_expression_batch_size: int = 1024, |
| 62 | event_loop: asyncio.AbstractEventLoop | None = None, |
| 63 | _stacklevel: int = 1, |
| 64 | ) -> None: |
| 65 | pathway_config = get_pathway_config() |
| 66 | self._graph = input_graph |
| 67 | self.debug = debug |
| 68 | if ignore_asserts is None: |
| 69 | ignore_asserts = pathway_config.ignore_asserts |
| 70 | self.ignore_asserts = ignore_asserts |
| 71 | self.monitoring_level = monitoring_level |
| 72 | self.with_http_server = with_http_server |
| 73 | self.default_logging = default_logging |
| 74 | self.persistence_config = persistence_config or pathway_config.replay_config |
| 75 | if runtime_typechecking is None: |
| 76 | self.runtime_typechecking = pathway_config.runtime_typechecking |
| 77 | else: |
| 78 | self.runtime_typechecking = runtime_typechecking |
| 79 | self.license_key = pathway_config.license_key |
| 80 | if terminate_on_error is None: |
| 81 | terminate_on_error = pathway_config.terminate_on_error |
| 82 | self.terminate_on_error = terminate_on_error |
| 83 | self.max_expression_batch_size = max_expression_batch_size |
| 84 | self.event_loop = event_loop |
| 85 | if not self.terminate_on_error: |
| 86 | warnings.warn( |
| 87 | "terminate_on_error=False mode is experimental", |
| 88 | stacklevel=_stacklevel + 1, |
| 89 | ) |
| 90 | |
| 91 | def run_nodes( |
| 92 | self, |
| 93 | nodes: Iterable[Operator], |
| 94 | /, |
| 95 | *, |
| 96 | after_build: Callable[[ScopeState, OperatorStorageGraph], None] | None = None, |