Batch and stream jobs¶
Two entry points named for intent rather than for the engine behind them.
gantry.batch is for work that ends; gantry.stream is for work that does not,
where "did it succeed" is the wrong question and "is it healthy" is the right
one.
See Flink backends for what each guarantees, and for the setup a real cluster needs.
Batch¶
gantry.batch.connect
¶
connect(
provider: str,
*,
endpoint: str,
config: Mapping[str, object] | None = None,
policy: Policy | None = None,
**options: object,
) -> BatchConnection
Source code in gantry/batch/api.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
gantry.batch.BatchConnection
¶
A configured batch provider connection.
Source code in gantry/batch/api.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
Stream¶
gantry.stream.connect
¶
connect(
provider: str,
*,
endpoint: str,
config: Mapping[str, object] | None = None,
policy: Policy | None = None,
**options: object,
) -> StreamConnection
Source code in gantry/stream/api.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
gantry.stream.StreamConnection
¶
A configured streaming provider connection.
Source code in gantry/stream/api.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Verification checks¶
Declarative verification checks and safe agent-input parsing.
MaterializationCheck
¶
Bases: Protocol
A trusted check evaluated against a table's metadata.
The same checks serve a materialization and a query. A materialization is
checked against the destination it created; a query is checked against the
shape of the rows it returned, described as a table so one check can do
both. Two of them do need a destination and say so with
requires_destination, which makes them unsupported on a query rather than
quietly true.
Source code in gantry/verify.py
22 23 24 25 26 27 28 29 30 31 32 33 34 | |
VerificationInputError
¶
Bases: ValueError
An agent supplied a check outside the declarative verification DSL.
Source code in gantry/verify.py
37 38 | |
VerificationUnsupported
¶
Bases: VerificationInputError
A valid check is not supported by this governed operation.
Source code in gantry/verify.py
41 42 | |
VerificationConflict
¶
Bases: VerificationInputError
The trusted and agent commitments cannot both be satisfied.
Source code in gantry/verify.py
45 46 | |
DocumentCount
dataclass
¶
Bases: RowCount
MongoDB spelling of a result-size assertion.
Source code in gantry/verify.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
RequiredFields
dataclass
¶
Bases: RequiredColumns
MongoDB spelling of a required-shape assertion.
Source code in gantry/verify.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
NullRate
dataclass
¶
The fraction of rows where one column is null, bounded above.
Measured at the destination by the provider, not reported by the statement that wrote it. A provider that cannot measure it makes the check unsupported rather than passing it, because an unmeasured bound would be indistinguishable from a satisfied one.
Source code in gantry/verify.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
null_rate
¶
null_rate(column: str, *, max: float) -> NullRate
Reject a destination where a column is emptier than it should be.
The failure this catches is a query that runs, produces the right number of rows, and joins wrongly — so the column everyone downstream keys on is null in most of them. Row count says the table is fine. This does not.
Source code in gantry/verify.py
243 244 245 246 247 248 249 250 | |
parse_agent_checks
¶
parse_agent_checks(
values: object, *, capabilities: Collection[str]
) -> tuple[object, ...]
Parse untrusted JSON into allowlisted check objects, failing closed.
Source code in gantry/verify.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
validate_agent_checks
¶
validate_agent_checks(
values: Sequence[object],
*,
capabilities: Collection[str],
) -> tuple[object, ...]
Validate direct-call check objects without allowing callbacks.
Source code in gantry/verify.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
check_config
¶
check_config(check: object) -> dict[str, object]
Return the bounded public commitment, never provenance or executable state.
Source code in gantry/verify.py
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | |
verification_schema
¶
verification_schema(
capabilities: Collection[str],
) -> dict[str, object]
JSON Schema for only the checks supported by one operation.
Source code in gantry/verify.py
484 485 486 487 488 489 | |
detect_conflicts
¶
detect_conflicts(
trusted: Sequence[object], agent: Sequence[object]
) -> None
Reject statically impossible count commitments before execution.
Source code in gantry/verify.py
492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |