aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHelen Koike <helen.koike@collabora.com>2023-12-24 12:55:47 -0300
committerMarge Bot <emma+marge@anholt.net>2024-01-17 13:10:07 +0000
commitb289028d0abf56f453be9b2ba01969bfe38c3352 (patch)
treecc74d27077411021e66e96e9b6f917bd83dafe16 /bin
parentffaa247b4fff72cd2045f37be526904c7ebd200c (diff)
downloadmesa3d-b289028d0abf56f453be9b2ba01969bfe38c3352.tar.gz
ci/ci_gantt_chart: show duration on hover
Show the duration of the given phase on hover. Signed-off-by: Helen Koike <helen.koike@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25793>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ci/ci_gantt_chart.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/ci/ci_gantt_chart.py b/bin/ci/ci_gantt_chart.py
index 882ab5424b3..8b9472217a0 100755
--- a/bin/ci/ci_gantt_chart.py
+++ b/bin/ci/ci_gantt_chart.py
@@ -10,6 +10,7 @@
import argparse
import gitlab
import plotly.express as px
+from gitlab_common import pretty_duration
from datetime import datetime, timedelta
from gitlab_common import read_token, GITLAB_URL, get_gitlab_pipeline_from_url
@@ -22,6 +23,17 @@ def calculate_queued_at(job):
return datetime.fromisoformat(started_at) - timedelta(seconds=job.queued_duration)
+def calculate_time_difference(time1, time2):
+ if not time1 or not time2:
+ return None
+ if type(time1) is str:
+ time1 = datetime.fromisoformat(time1.replace("Z", "+00:00"))
+ if type(time2) is str:
+ time2 = datetime.fromisoformat(time2.replace("Z", "+00:00"))
+
+ diff = time2 - time1
+ return pretty_duration(diff.seconds)
+
def create_task_name(job):
status_color = {"success": "green", "failed": "red"}.get(job.status, "grey")
@@ -37,6 +49,7 @@ def add_gantt_bar(job, tasks):
"Job": task_name,
"Start": job.created_at,
"Finish": queued_at,
+ "Duration": calculate_time_difference(job.created_at, queued_at),
"Phase": "Waiting dependencies",
}
)
@@ -45,6 +58,7 @@ def add_gantt_bar(job, tasks):
"Job": task_name,
"Start": queued_at,
"Finish": job.started_at,
+ "Duration": calculate_time_difference(queued_at, job.started_at),
"Phase": "Queued",
}
)
@@ -53,6 +67,7 @@ def add_gantt_bar(job, tasks):
"Job": task_name,
"Start": job.started_at,
"Finish": job.finished_at,
+ "Duration": calculate_time_difference(job.started_at, job.finished_at),
"Phase": "Running",
}
)
@@ -86,6 +101,7 @@ def generate_gantt_chart(pipeline):
y="Job",
color="Phase",
title=title,
+ hover_data=["Duration"],
)
# Calculate the height dynamically