Skip to content

Commit 065d5a7

Browse files
committed
feat: show load factor on pipeline dashboard
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 6742ba6 commit 065d5a7

File tree

1 file changed

+71
-5
lines changed

1 file changed

+71
-5
lines changed

vulnerabilities/templates/pipeline_dashboard.html

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{% extends "base.html" %}
22

3+
{% load utils %}
4+
35
{% block title %}
46
Pipeline Dashboard
57
{% endblock %}
@@ -22,6 +24,18 @@
2224
.column {
2325
word-break: break-word;
2426
}
27+
28+
.has-text-orange {
29+
color: #ff8c42 !important;
30+
}
31+
32+
.has-tooltip-orange::before {
33+
background-color: #ff8c42 !important;
34+
}
35+
36+
.has-tooltip-orange::after {
37+
border-top-color: #ff8c42 !important;
38+
}
2539
</style>
2640
{% endblock %}
2741

@@ -48,11 +62,63 @@ <h1>Pipeline Dashboard</h1>
4862
</form>
4963

5064
<div class="box">
51-
<div class="column has-text-right">
52-
<p class="has-text-weight-semibold">
53-
{{ active_pipeline_count|default:0 }} active pipeline{{ active_pipeline_count|default:0|pluralize }},
54-
{{ disabled_pipeline_count|default:0 }} disabled pipeline{{ disabled_pipeline_count|default:0|pluralize }}
55-
</p>
65+
<div class="columns is-multiline is-vcentered mb-0">
66+
<div class="column is-half has-text-left">
67+
{% if load_per_queue %}
68+
<p class="ml-3">
69+
<span class="has-text-weight-bold has-text-black is-size-6 has-tooltip-arrow has-tooltip-multiline"
70+
data-tooltip="Load factor is the ratio of the total compute required to run all active pipelines
71+
in a queue to the available worker capacity for that queue over a 24-hour period.
72+
A value greater than 1 indicates that the number of workers is insufficient to
73+
run all pipelines within the schedule.">
74+
Load Factor:
75+
</span>
76+
{% for queue_name, values in load_per_queue.items %}
77+
78+
<span class="has-text-weight-bold is-size-6 has-tooltip-arrow has-tooltip-multiline"
79+
data-tooltip="{{ queue_name|capfirst }} priority pipeline queue.">
80+
{{ queue_name| capfirst }}
81+
</span>
82+
{% with load_factor=values|get_item:"load_factor" additional=values|get_item:"additional_worker" %}
83+
{% if load_factor == "no_worker" %}
84+
<span class="has-text-weight-bold is-size-6 has-text-danger has-tooltip-arrow has-tooltip-multiline has-tooltip-danger"
85+
data-tooltip="All workers in the {{ queue_name }} queue are down. Please run {{ additional }}
86+
worker{{ additional|pluralize }} for the {{ queue_name }} queue.">
87+
<span class="icon"><i class="fa fa-exclamation-triangle"></i></span>
88+
</span>
89+
{% elif load_factor < 1 %}
90+
<span class="has-text-weight-bold is-size-6 has-text-success has-tooltip-arrow has-tooltip-multiline has-tooltip-success"
91+
data-tooltip="{{ queue_name|capfirst }} queue perfectly balanced.">
92+
{{ load_factor|floatformat:2 }}
93+
<span class="icon"><i class="fa fa-check-circle"></i></span>
94+
</span>
95+
{% elif load_factor < 1.6 %}
96+
<span class="has-text-weight-bold is-size-6 has-text-orange has-tooltip-arrow has-tooltip-multiline has-tooltip-orange"
97+
data-tooltip="Consider adding {{ additional }} additional worker{{ additional|pluralize }} to the {{ queue_name }} queue.">
98+
{{ load_factor|floatformat:2 }}
99+
<span class="icon"><i class="fa fa-info-circle"></i></span>
100+
</span>
101+
{% else %}
102+
<span class="has-text-weight-bold is-size-6 has-text-danger has-tooltip-arrow has-tooltip-multiline has-tooltip-danger"
103+
data-tooltip="Consider adding {{ additional }} additional worker{{ additional|pluralize }} to the {{ queue_name }} queue.">
104+
{{ load_factor|floatformat:2 }}
105+
<span class="icon"><i class="fa fa-exclamation-circle"></i></span>
106+
</span>
107+
{% endif %}
108+
{% endwith %}
109+
110+
{% if not forloop.last %} &bull; {% endif %}
111+
112+
{% endfor %}
113+
</p>
114+
{% endif %}
115+
</div>
116+
<div class="column is-half has-text-right">
117+
<p class="has-text-grey-dark has-text-weight-semibold mr-3">
118+
{{ active_pipeline_count|default:0 }} active pipeline{{ active_pipeline_count|default:0|pluralize }},
119+
{{ disabled_pipeline_count|default:0 }} disabled pipeline{{ disabled_pipeline_count|default:0|pluralize }}
120+
</p>
121+
</div>
56122
</div>
57123
<table class="table is-striped is-hoverable is-fullwidth">
58124
<thead>

0 commit comments

Comments
 (0)