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:
@@ -394,13 +394,8 @@ class MetricsCollector:
|
||||
prune: bool,
|
||||
) -> None:
|
||||
with Session(engine) as session:
|
||||
for (flow, node, minute), agg in buckets.items():
|
||||
statement = insert(MetricBucket).values(
|
||||
flow=flow,
|
||||
node=node,
|
||||
bucket=datetime.fromtimestamp(minute, UTC),
|
||||
**agg,
|
||||
)
|
||||
if buckets:
|
||||
statement = insert(MetricBucket)
|
||||
# The same minute is written several times, so the counters add
|
||||
# and the maxima take whichever is larger. Columns are read by
|
||||
# subscript: `excluded.items` is the collection's own method.
|
||||
@@ -418,21 +413,36 @@ class MetricsCollector:
|
||||
name: func.max(col(getattr(MetricBucket, name)), new[name])
|
||||
for name in MAXIMA
|
||||
},
|
||||
)
|
||||
),
|
||||
[
|
||||
{
|
||||
"flow": flow,
|
||||
"node": node,
|
||||
"bucket": datetime.fromtimestamp(minute, UTC),
|
||||
**agg,
|
||||
}
|
||||
for (flow, node, minute), agg in buckets.items()
|
||||
],
|
||||
)
|
||||
|
||||
for run in runs:
|
||||
values = {k: v for k, v in run.items() if k != "started_ts"}
|
||||
statement = insert(FlowRun).values(**values)
|
||||
if runs:
|
||||
values = [
|
||||
{k: v for k, v in run.items() if k != "started_ts"} for run in runs
|
||||
]
|
||||
statement = insert(FlowRun)
|
||||
session.execute(
|
||||
statement.on_conflict_do_update(
|
||||
index_elements=["id"],
|
||||
set_={
|
||||
key: statement.excluded[key]
|
||||
for key in values
|
||||
for key in values[0]
|
||||
if key != "id"
|
||||
},
|
||||
)
|
||||
),
|
||||
values,
|
||||
# A redelivery clears finished_at. Include nulls in the
|
||||
# batch so open and finished runs share the same statement.
|
||||
execution_options={"render_nulls": True},
|
||||
)
|
||||
|
||||
session.add_all(pending)
|
||||
|
||||
Reference in New Issue
Block a user