From c850aa2583f312d7a16aa064133365963fb05248 Mon Sep 17 00:00:00 2001 From: "Thomas B. Mooney" Date: Tue, 14 Feb 2023 13:12:49 -0600 Subject: [PATCH] Handle backendStatus "Success" with executionStatus "RetryableFailure" --- scripts/estimate_billing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/estimate_billing.py b/scripts/estimate_billing.py index f50381c..01f57c7 100644 --- a/scripts/estimate_billing.py +++ b/scripts/estimate_billing.py @@ -118,11 +118,13 @@ def cost_disks(disks, duration_seconds): def machine_duration(task): events = task["executionEvents"] - status = task["backendStatus"] + bStatus = task["backendStatus"] + eStatus = task["executionStatus"] + def find_description(desc): return next(event for event in events if event["description"] == desc) - if status == "Success": + if bStatus == "Success" and eStatus == "Done": def is_start(desc): return desc.startswith("Worker ") and desc.endswith("machine") start_event = next(event for event in events if is_start(event["description"])) @@ -132,7 +134,7 @@ def is_start(desc): end_event = find_description("UpdatingJobStore") if not (start_event and end_event): - raise NotImplementedError(f"machine duration couldn't be determined for task. Had backendStatus {status} and events {events}") + raise NotImplementedError(f"machine duration couldn't be determined for task. Had backendStatus {bStatus} executionStatus {eStatus} and events {events}") return start_event["startTime"], end_event["endTime"]