a2a-source-edit: write agent.py
This commit is contained in:
29
agent.py
29
agent.py
@@ -189,7 +189,6 @@ class ProductionProofV116HighUtili72551(
|
|||||||
"min_severity": min_severity,
|
"min_severity": min_severity,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
history: list[dict[str, Any]] = []
|
|
||||||
try:
|
try:
|
||||||
history = _persist_dashboard_run(
|
history = _persist_dashboard_run(
|
||||||
tenant_key=tenant,
|
tenant_key=tenant,
|
||||||
@@ -392,18 +391,6 @@ def _persist_dashboard_run(
|
|||||||
artifact_media_type: str,
|
artifact_media_type: str,
|
||||||
artifact_size: int,
|
artifact_size: int,
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
payload = {
|
|
||||||
"rows": [row.model_dump() for row in rows],
|
|
||||||
"filtered_rows": [row.model_dump() for row in filtered],
|
|
||||||
"filters": filters,
|
|
||||||
"trends": trends,
|
|
||||||
"exceptions": exceptions,
|
|
||||||
"artifact": {
|
|
||||||
"name": artifact_name,
|
|
||||||
"media_type": artifact_media_type,
|
|
||||||
"size_bytes": artifact_size,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
receipt_payload = {
|
receipt_payload = {
|
||||||
"receipt_id": receipt_id,
|
"receipt_id": receipt_id,
|
||||||
"run_id": run_id,
|
"run_id": run_id,
|
||||||
@@ -434,7 +421,7 @@ def _persist_dashboard_run(
|
|||||||
json.dumps(filters),
|
json.dumps(filters),
|
||||||
json.dumps(trends),
|
json.dumps(trends),
|
||||||
json.dumps(exceptions),
|
json.dumps(exceptions),
|
||||||
json.dumps(payload["filtered_rows"]),
|
json.dumps([row.model_dump() for row in filtered]),
|
||||||
artifact_name,
|
artifact_name,
|
||||||
artifact_media_type,
|
artifact_media_type,
|
||||||
artifact_size,
|
artifact_size,
|
||||||
@@ -482,13 +469,6 @@ def _persist_scheduled_rollup(
|
|||||||
).fetchone()
|
).fetchone()
|
||||||
if existing:
|
if existing:
|
||||||
return {"run_id": str(existing[0]), "receipt_id": str(existing[1]), "already_processed": True}
|
return {"run_id": str(existing[0]), "receipt_id": str(existing[1]), "already_processed": True}
|
||||||
conn.execute(
|
|
||||||
"""
|
|
||||||
INSERT INTO scheduled_rollups (tenant_key, run_key, run_id, receipt_id, created_at)
|
|
||||||
VALUES (%s, %s, %s, %s, %s)
|
|
||||||
""",
|
|
||||||
(tenant_key, run_key, run_id, receipt_id, created_at),
|
|
||||||
)
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO dashboard_runs (
|
INSERT INTO dashboard_runs (
|
||||||
@@ -534,6 +514,13 @@ def _persist_scheduled_rollup(
|
|||||||
created_at,
|
created_at,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
conn.execute(
|
||||||
|
"""
|
||||||
|
INSERT INTO scheduled_rollups (tenant_key, run_key, run_id, receipt_id, created_at)
|
||||||
|
VALUES (%s, %s, %s, %s, %s)
|
||||||
|
""",
|
||||||
|
(tenant_key, run_key, run_id, receipt_id, created_at),
|
||||||
|
)
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return {"run_id": run_id, "receipt_id": receipt_id, "already_processed": False}
|
return {"run_id": run_id, "receipt_id": receipt_id, "already_processed": False}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user