Skip to content

Commit

Permalink
Merge branch 'main' into mermaid-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
lewismiddleton authored Apr 3, 2024
2 parents 8a06255 + 87e8ea2 commit be47904
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions runner_manager/jobs/workflow_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,20 @@ def log_workflow_job(webhook: WorkflowJobEvent) -> None:
def time_to_start(webhook: WorkflowJobEvent) -> timedelta:
"""From a given webhook, calculate the time it took to start the job"""

assert isinstance(webhook.workflow_job.started_at, datetime)
assert isinstance(webhook.workflow_job.created_at, datetime)
return webhook.workflow_job.started_at - webhook.workflow_job.created_at
if isinstance(webhook.workflow_job.created_at, str):
created_at = datetime.fromisoformat(webhook.workflow_job.created_at)
else:
created_at = webhook.workflow_job.created_at

if isinstance(webhook.workflow_job.started_at, str):
started_at = datetime.fromisoformat(webhook.workflow_job.started_at)
else:
started_at = webhook.workflow_job.started_at

assert isinstance(started_at, datetime)
assert isinstance(created_at, datetime)

return started_at - created_at


def completed(webhook: WorkflowJobCompleted) -> int:
Expand Down

0 comments on commit be47904

Please sign in to comment.