Skip to content

Commit

Permalink
Handle backendStatus "Success" with executionStatus "RetryableFailure"
Browse files Browse the repository at this point in the history
  • Loading branch information
tmooney committed Feb 14, 2023
1 parent 2984870 commit c850aa2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/estimate_billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]))
Expand All @@ -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"]

Expand Down

0 comments on commit c850aa2

Please sign in to comment.