Debian Codegraph @

src/webdash/templates/default/jobs/queue_stats.html

raw symbols SCIP
1 {% extends 'layouts/base.html' %}
2
3 {% set active_menu = 'jobqueue' %}
4 {% set page_title = 'Job Queue Statistics' %}
5
6 {% block body_header %}
7 <h1 class="title mb-4">Job Queue Statistics</h1>
8 {% endblock %}
9
10 {% block js_pre %}
11 <script src="{{ url_for('static', filename='js/moment/moment.min.js') }}"></script>
12 <script src="{{ url_for('static', filename='js/chart/chart.umd.js') }}"></script>
13 <script src="{{ url_for('static', filename='js/chart/chartjs-adapter-moment.min.js') }}"></script>
14 {% endblock %}
15
16 {% block body %}
17
18 <div class="columns is-mobile">
19 <div class="column is-8">
20
21 <div class="buttons has-addons">
22 <a class="button"
23 href="{{ url_for('jobs.queue', page=1, blocked='false')}}">
24 Only Pending
25 </a>
26 <a class="button"
27 href="{{ url_for('jobs.queue', page=1, blocked='true')}}">
28 Pending &amp; Blocked
29 </a>
30 <a class="button"
31 href="{{ url_for('jobs.list_completed', page=1)}}">
32 Recently Completed
33 </a>
34 <a class="button is-info is-selected"
35 href="{{ url_for('jobs.queue_stats')}}">
36 Graphs
37 </a>
38 </div>
39
40 <h4 class="title is-4">Pending Jobs</h4>
41 <canvas id="pendingJobsChart" style="width:100%;max-height:320px"></canvas>
42 <p>These jobs were waiting for a free machine to be built on.</p>
43
44 <h4 class="title is-4 pt-6">Blocked Jobs</h4>
45 <canvas id="blockedJobsChart" style="width:100%;max-height:320px"></canvas>
46 <p>These jobs were blocked by other dependencies and could not yet be built.</p>
47
48 <script>
49 function makeDatasets(rawDataStr) {
50 if (!rawDataStr)
51 return [];
52
53 const allRawDataObj = JSON.parse(rawDataStr);
54 var datasets = [];
55 for (const [archName, rawData] of Object.entries(allRawDataObj)) {
56 const data = rawData.map(item => {
57 return {
58 x: new Date(item.x * 1000),
59 y: item.y
60 };
61 });
62
63 datasets.push({
64 data: data,
65 label: archName,
66 fill: false
67 });
68 }
69
70 return datasets;
71 }
72
73 const pendingDatasets = makeDatasets('{{pending_stats|safe}}');
74 const depwaitDatasets = makeDatasets('{{depwait_stats|safe}}');
75
76 // pending
77 new Chart('pendingJobsChart', {
78 type: 'line',
79 data: {
80 datasets: pendingDatasets
81 },
82 options: {
83 scales: {
84 x: {
85 type: 'time',
86 time: {
87 unit: 'month',
88 displayFormats: {
89 day: 'YYYY-MM',
90 }
91 }
92 }
93 }
94 }
95 });
96
97 // depwait
98 new Chart('blockedJobsChart', {
99 type: 'line',
100 data: {
101 datasets: depwaitDatasets
102 },
103 options: {
104 scales: {
105 x: {
106 type: 'time',
107 time: {
108 unit: 'month',
109 displayFormats: {
110 day: 'YYYY-MM',
111 }
112 }
113 }
114 }
115 }
116 });
117 </script>
118
119 </div>
120 </div>
121 {% endblock %}