Fix work recovery and reduce engine and chart overhead
Docs / docs (push) Successful in 33s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m37s
Playwright Tests / test-playwright (2, 2) (push) Failing after 27s
pre-commit / pre-commit (push) Failing after 2m37s
Test Backend / test-backend (3.12) (push) Successful in 5m7s
Test Backend / test-backend (3.14) (push) Successful in 5m2s
Compose Smoke Test / test-compose (push) Failing after 28s
Playwright Tests / merge-reports (push) Failing after 2m29s
Docs / docs (push) Successful in 33s
Playwright Tests / test-playwright (1, 2) (push) Failing after 1m37s
Playwright Tests / test-playwright (2, 2) (push) Failing after 27s
pre-commit / pre-commit (push) Failing after 2m37s
Test Backend / test-backend (3.12) (push) Successful in 5m7s
Test Backend / test-backend (3.14) (push) Successful in 5m2s
Compose Smoke Test / test-compose (push) Failing after 28s
Playwright Tests / merge-reports (push) Failing after 2m29s
This commit is contained in:
@@ -160,6 +160,61 @@ def test_a_flush_the_database_refused_is_written_by_the_next_one(
|
||||
assert audit.detail == "held back"
|
||||
|
||||
|
||||
def test_batched_rollups_add_and_redelivery_clears_a_finished_run(db: Session) -> None:
|
||||
collector = MetricsCollector(EventBus())
|
||||
ts = time.time()
|
||||
for i in range(2):
|
||||
collector.handle(
|
||||
{"type": "cascade_started", "run": f"bulk-{i}", "flow": "bulk", "ts": ts}
|
||||
)
|
||||
collector.handle(
|
||||
{
|
||||
"type": "node_executed",
|
||||
"flow": "bulk",
|
||||
"node": f"bulk.n{i}",
|
||||
"run": f"bulk-{i}",
|
||||
"outputs": 1,
|
||||
"duration_ms": 10.0,
|
||||
"ts": ts,
|
||||
}
|
||||
)
|
||||
collector.handle({"type": "cascade_finished", "run": "bulk-0", "ts": ts + 1})
|
||||
# Write the same open/finished batch twice, as a retained run is upserted.
|
||||
collector._write(collector._buckets, [], list(collector._runs.values()), False)
|
||||
collector.handle(
|
||||
{
|
||||
"type": "cascade_started",
|
||||
"run": "bulk-0",
|
||||
"flow": "bulk",
|
||||
"deliveries": 2,
|
||||
"ts": ts + 2,
|
||||
}
|
||||
)
|
||||
collector.handle({"type": "cascade_finished", "run": "bulk-1", "ts": ts + 3})
|
||||
for bucket in collector._buckets.values():
|
||||
bucket["duration_sum_ms"] = 4.0
|
||||
bucket["duration_max_ms"] = 4.0
|
||||
collector._write(collector._buckets, [], list(collector._runs.values()), False)
|
||||
|
||||
buckets = db.exec(select(MetricBucket).where(MetricBucket.flow == "bulk")).all()
|
||||
assert len(buckets) == 2
|
||||
assert all(
|
||||
(b.executions, b.messages, b.duration_sum_ms, b.duration_max_ms)
|
||||
== (2, 2, 14.0, 10.0)
|
||||
for b in buckets
|
||||
)
|
||||
reopened = db.get(FlowRun, "bulk-0")
|
||||
assert reopened is not None
|
||||
assert (reopened.status, reopened.finished_at, reopened.deliveries) == (
|
||||
"running",
|
||||
None,
|
||||
2,
|
||||
)
|
||||
finished = db.get(FlowRun, "bulk-1")
|
||||
assert finished is not None and finished.finished_at is not None
|
||||
assert finished.status == "ok"
|
||||
|
||||
|
||||
def test_a_node_id_wider_than_the_column_still_records(db: Session) -> None:
|
||||
collector = MetricsCollector(EventBus())
|
||||
ts = datetime.now(UTC).replace(second=0, microsecond=0).timestamp()
|
||||
|
||||
Reference in New Issue
Block a user