Commit a94516a9 authored by Daniele Venzano's avatar Daniele Venzano

Small bug fixes

* print floats with only 2 decimals in the status page
* delete dead containers that are forgot after crashing
* reconsider services for scheduling that should be active, but are dead (they crashed and are elastic)
parent c71c363a
......@@ -176,7 +176,7 @@
data = {
datasets: [{
label: 'Cores',
data: [{{ node['cores_reserved'] }}, {{ node['cores_allocated'] }}, {{ node['cores_in_use'] }}],
data: [{{ '%0.2f'|format(node['cores_reserved']|float) }}, {{ '%0.2f'|format(node['cores_allocated']|float) }}, {{ '%0.2f'|format(node['cores_in_use']|float) }}],
backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(53, 51, 144, 1.0)', 'rgba(145, 192, 46, 1.0)']
}],
'labels': ['Reserved', 'Allocated', 'In use']
......@@ -221,7 +221,9 @@
<tr>
<td class="cell-host">{{ node.name }}</td>
{% for service in services_per_node[node.name] %}
<td><a href="{{ reverse_url('execution_inspect', service['execution_id']) }}">{{ service['name'] }}</a> (M: <script>format_bytes({{ node.service_stats[service['id']|string]['mem_limit'] }});</script> C: {{ node.service_stats[service['id']|string]['core_limit'] }})</td>
{% if service.backend_status == "started" %}
<td><a href="{{ reverse_url('execution_inspect', service['execution_id']) }}">{{ service['name'] }}</a> (M: <script>format_bytes({{ node.service_stats[service['id']|string]['mem_limit'] }});</script> C: {{ '%0.2f'|format(node.service_stats[service['id']|string]['core_limit']|float) }})</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
......
......@@ -86,6 +86,9 @@ class DockerStateSynchronizer(threading.Thread):
service = self.state.services.select(only_one=True, backend_host=host_config.name, backend_id=cont['id'])
if service is None:
log.warning('Container {} on host {} has no corresponding service'.format(cont['name'], host_config.name))
if cont['state'] == Service.BACKEND_DIE_STATUS:
log.warning('Terminating dead and orphan container {}'.format(cont['name']))
my_engine.terminate_container(cont['id'], delete=True)
continue
self._update_service_status(service, cont)
self.host_stats[host_config.name].memory_reserved += service.resource_reservation.memory.min
......
......@@ -135,7 +135,7 @@ class SimulatedPlatform:
"""Try to find an allocation for elastic services"""
at_least_one_allocated = False
for service in execution.elastic_services:
if service.status == service.ACTIVE_STATUS:
if service.status == service.ACTIVE_STATUS and service.backend_status != service.BACKEND_DIE_STATUS:
continue
candidate_nodes = []
for node_id_, node in self.nodes.items():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment