Skip to content

Commit f4c869a

Browse files
committed
Show pipeline runtime in API and UI
Signed-off-by: Keshav Priyadarshi <[email protected]>
1 parent 8bbc7f8 commit f4c869a

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

vulnerabilities/api_v2.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,16 +769,15 @@ def has_permission(self, request, view):
769769

770770
class PipelineRunAPISerializer(serializers.HyperlinkedModelSerializer):
771771
status = serializers.SerializerMethodField()
772-
execution_time = serializers.SerializerMethodField()
772+
runtime = serializers.SerializerMethodField()
773773
log = serializers.SerializerMethodField()
774-
execution_time = serializers.SerializerMethodField()
775774

776775
class Meta:
777776
model = PipelineRun
778777
fields = [
779778
"run_id",
780779
"status",
781-
"execution_time",
780+
"runtime",
782781
"run_start_date",
783782
"run_end_date",
784783
"run_exitcode",
@@ -792,9 +791,9 @@ class Meta:
792791
def get_status(self, run):
793792
return run.status
794793

795-
def get_execution_time(self, run):
796-
if run.execution_time:
797-
return f"{round(run.execution_time, 2)}s"
794+
def get_runtime(self, run):
795+
if run.runtime:
796+
return f"{round(run.runtime, 2)}s"
798797

799798
def get_log(self, run):
800799
"""Return only last 5000 character of log."""

vulnerabilities/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,7 @@ def run_running(self):
21162116
return self.status == self.Status.RUNNING
21172117

21182118
@property
2119-
def execution_time(self):
2119+
def runtime(self):
21202120
"""Return the pipeline execution time."""
21212121
if not self.run_start_date or (not self.run_end_date and not self.run_running):
21222122
return

vulnerabilities/templates/pipeline_run_details.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ <h1 class="title">{{ pipeline_name }} Run Log</h1>
6161
</p>
6262
</div>
6363
<div class="column is-one-fifth-desktop is-one-quarter-tablet is-half-mobile">
64-
<p class="is-size-7 has-text-weight-semibold">Execution Time</p>
64+
<p class="is-size-7 has-text-weight-semibold">Runtime</p>
6565
<p class="has-text-grey is-size-7">
66-
{% if run.execution_time %}
67-
{{ run.execution_time|humanize_duration }}
66+
{% if run.runtime %}
67+
{{ run.runtime|humanize_duration }}
6868
{% else %}
6969
N/A
7070
{% endif %}

vulnerabilities/templates/pipeline_run_list.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ <h1>{{ pipeline_name }} Runs</h1>
5757
<div class="columns is-mobile is-vcentered">
5858
<div class="column is-one-quarter">Job ID</div>
5959
<div class="column is-one-eighth">Status</div>
60-
<div class="column is-one-eighth">Execution Time</div>
60+
<div class="column is-one-eighth">Runtime</div>
6161
<div class="column is-one-fifth">Start Time</div>
6262
<div class="column is-one-fifth">End Time</div>
6363
</div>
@@ -79,8 +79,8 @@ <h1>{{ pipeline_name }} Runs</h1>
7979
</span>
8080
</div>
8181
<div class="column is-one-eighth has-text-grey">
82-
{% if run.execution_time %}
83-
{{ run.execution_time|humanize_duration }}
82+
{% if run.runtime %}
83+
{{ run.runtime|humanize_duration }}
8484
{% else %}
8585
N/A
8686
{% endif %}

0 commit comments

Comments
 (0)