status.html 9.43 KB
Newer Older
1 2 3
{% extends "base_user.html" %}
{% block title %}Zoe system status{% endblock %}

4 5 6 7
{% block custom_head %}
    <script src="/static/Chart.min.js" type="application/javascript"></script>
{% endblock %}

8 9 10
{% block content %}
<h2>Zoe system status</h2>

11 12 13 14 15 16 17 18 19 20
    <div>
    <h3 class="section">Index</h3>
    <ul>
        <li><a href="#scheduler">Scheduler</a></li>
        <li><a href="#platform">Platform</a></li>
        <li><a href="#service-distrib">Service distribution</a></li>
    </ul>
    </div>

    <h3 class="section"><a name="scheduler">Scheduler</a></h3>
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

    <ul>
        <li>Queue length: <span id="sched_queue_len">{{ stats.queue_length }}</span></li>
        <li>Running queue length: <span id="sched_running_queue_len">{{ stats.running_length }}</span></li>
        <li>On-going clean-up threads: <span id="termination_threads_count">{{ stats.termination_threads_count }}</span></li>
    </ul>

    <h4>Queue</h4>
    <p>Service border legend:</p>
    <ul>
        <li>Green/red: service is active/inactive. Active services have been scheduled and placed.</li>
        <li>Solid/dashed: service is essential/elastic</li>
    </ul>
    <div class="scheduler_queue">
    {% for id in stats['queue'] %}
        <div class="queue_item" id="{{ id }}">
37
            <a href="{{ reverse_url('execution_inspect', id) }}">{{ id }}</a> ({{ executions_in_queue[id].user_id }})
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
            {% for service in executions_in_queue[id].services %}
                {% if service.essential %}
                <div class="service essential {{ 'running' if service.status == service.ACTIVE_STATUS }}">
                    {{ service['name'] }}<br/>
                    M: <script>format_bytes({{ service['resource_reservation']['memory']['max'] }});</script><br/>
                    C: {{ service['resource_reservation']['cores']['max'] }}
                </div>
                {% endif %}
            {% endfor %}
            {% for service in executions_in_queue[id].services %}
                {% if not service.essential %}
                <div class="service {{ 'running' if service.status == service.ACTIVE_STATUS }}">
                    {{ service['name'] }}<br/>
                    M: <script>format_bytes({{ service['resource_reservation']['memory']['max'] }});</script><br/>
                    C: {{ service['resource_reservation']['cores']['max'] }}
                </div>
                {% endif %}
            {% endfor %}
        </div>
    {% endfor %}
    {% if stats['queue']|length == 0 %}
    <p>The queue is empty.</p>
    {% endif %}
    </div>

    <h4>Running queue</h4>
    <p>This queue is unsorted, all services here should be green.</p>
    <div class="scheduler_queue">
    {% for id in stats['running_queue'] %}
                <div class="queue_item" id="{{ id }}">
68
            <a href="{{ reverse_url('execution_inspect', id) }}">{{ id }}</a> ({{ executions_in_queue[id].user_id }})
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
            {% for service in executions_in_queue[id].services %}
                {% if service.essential %}
                <div class="service essential {{ 'running' if service.status == service.ACTIVE_STATUS }}">
                    {{ service['name'] }}<br/>
                    M: <script>format_bytes({{ service['resource_reservation']['memory']['max'] }});</script><br/>
                    C: {{ service['resource_reservation']['cores']['max'] }}
                </div>
                {% endif %}
            {% endfor %}
            {% for service in executions_in_queue[id].services %}
                {% if not service.essential %}
                <div class="service {{ 'running' if service.status == service.ACTIVE_STATUS }}">
                    {{ service['name'] }}<br/>
                    M: <script>format_bytes({{ service['resource_reservation']['memory']['max'] }});</script><br/>
                    C: {{ service['resource_reservation']['cores']['max'] }}
                </div>
                {% endif %}
            {% endfor %}
        </div>
    {% endfor %}
    {% if stats['running_queue']|length == 0 %}
    <p>The running queue is empty.</p>
    {% endif %}
    </div>

94
    <h3 class="section"><a name="platform">Platform</a></h3>
95 96 97 98 99 100 101 102 103
    <ul>
        <li>Total containers: {{ stats.platform_stats.container_count }}</li>
        <li>Total memory: <script>format_bytes({{ stats.platform_stats.memory_total }}, 2) </script></li>
        <li>Total cores: {{ stats.platform_stats.cores_total }}</li>
    </ul>

    <div class="platform_node_detail">
    {% for node in stats.platform_stats.nodes %}
        <div class="node_detail">
104 105 106 107 108 109
        <div class="node_name">
            {{ node['name'] }}
            {% if node['status'] == 'offline' %}
                (node is offline/unreachable)
            {% endif %}
        </div>
110
        <div class="container_count">{{ node['container_count'] }} containers</div>
111 112 113 114 115 116 117 118 119
        {% if node['labels']|length > 0 %}
        <div class="container_count">Labels:
            {% for label in node['labels'] %}
            {{ label }}&nbsp;
            {% endfor %}
        </div>
        {% else %}
        <div class="container_count">No labels</div>
        {% endif %}
120 121 122 123

        <div class="plot-container">
            <p>Memory</p>
            <div class="pie-plots">
124
                <canvas class="node_status_canvas" id="{{ node.name }}-mem"></canvas>
125
            </div>
126
        </div>
127 128 129
        <script>
        data = {
            datasets: [{
130 131
                label: 'Memory',
                data: [{{ node['memory_reserved'] }}, {{ node['memory_in_use'] }}],
132 133
                backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
            }],
134
            'labels': ['Reserved', 'In use']
135
        };
136
        ctx = document.getElementById("{{ node.name }}-mem").getContext('2d');
137
        new Chart(ctx,{
138
            type: 'bar',
139 140 141
            data: data,
            options: {
                animation: {
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
                    duration: 0
                },
                responsiveAnimationDuration: 0,
                scales: {
                    yAxes: [{
                        ticks: {
                            callback: function(value, index, values) {
                                return format_bytes_ret(value);
                            },
                            max: {{ node['memory_total'] }}
                        }
                    }]
                },
                legend: {
                    display: false
                },
                tooltips: {
                    callbacks: {
                        label: function(tooltipItem, data) {
                            return format_bytes_ret(tooltipItem.yLabel);
                        }
                    }
164 165 166 167 168 169 170 171
                }
            }
        });
        </script>

        <div class="plot-container">
            <p>Cores</p>
            <div class="pie-plots">
172
                <canvas class="node_status_canvas" id="{{ node.name }}-cpu"></canvas>
173
            </div>
174
        </div>
175 176 177 178
        <script>
        data = {
            datasets: [{
                label: 'Reserved cores',
179
                data: [{{ node['cores_reserved'] }}, {{ node['cores_in_use'] }}],
180 181
                backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
            }],
182
            'labels': ['Reserved', 'In use']
183
        };
184
        ctx = document.getElementById("{{ node.name }}-cpu").getContext('2d');
185
        new Chart(ctx,{
186
            type: 'bar',
187 188 189
            data: data,
            options: {
                animation: {
190 191 192 193 194 195 196 197 198 199 200 201 202
                    duration: 0
                },
                responsiveAnimationDuration: 0,
                scales: {
                    yAxes: [{
                        ticks: {
                            max: {{ node['cores_total'] }},
                            stepSize: 8
                        }
                    }]
                },
                legend: {
                    display: false
203 204 205 206 207 208 209
                }
            }
        });

        data = {
            datasets: [{
                label: 'Used memory',
210
                data: [{{ node['cores_in_use'] }}, {{ node['cores_total'] - node['cores_in_use'] }}],
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
                backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
            }],
            'labels': ['In-use', 'Free']
        };
        ctx = document.getElementById("{{ node.name }}-cpu-use").getContext('2d');
        myPieChart = new Chart(ctx,{
            type: 'pie',
            data: data,
            options: {
                animation: {
                    animateRotate: false
                }
            }
        });
        </script>
226 227 228 229
        </div>
    {% endfor %}
    </div>

230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
    <h3 class="section"><a name="service-distrib">Service distribution</a></h3>
    <table class="service-distrib">
    <thead>
    <tr>
        <th class="cell-host">Host</th>
        <th colspan="{{ max_service_count }}">Services and reserved resources</th>
    </tr>
    </thead>
    <tbody>
    {% for node in stats.platform_stats.nodes %}
    <tr>
        <td class="cell-host">{{ node.name }}</td>
        {% for service in node.services %}
            <td><a href="{{ reverse_url('execution_inspect', service['execution_id']) }}">{{ service['name'] }}</a> (M: <script>format_bytes({{ service['description']['resources']['memory']['max'] }});</script> C: {{ service['description']['resources']['cores']['max'] }})</td>
        {% endfor %}
    </tr>
    {% endfor %}
    </tbody>
    </table>

    <script>
    function refresh_page() {
        document.location.reload();
    }
    setInterval(refresh_page, 15000);
    </script>
256
{% endblock %}