Commit da0c97e8 authored by Daniele Venzano's avatar Daniele Venzano 🏇
Browse files

Merge branch 'devel/release' into 'master'

Better logging of why services cannot be fitted on nodes

See merge request !61
parents dddeb332 2c62dee7
......@@ -151,7 +151,7 @@ class DockerClient:
'external_address': self.docker_config.external_address
} # type: Dict[str, Any]
try:
info['host'] = container.attrs['Node']['Name'],
info['host'] = container.attrs['Node']['Name']
except KeyError:
info['host'] = 'N/A'
......
......@@ -240,7 +240,7 @@ class SwarmClient:
'labels': container.attrs['Config']['Labels']
} # type: Dict[str, Any]
try:
info['host'] = container.attrs['Node']['Name'],
info['host'] = container.attrs['Node']['Name']
except KeyError:
info['host'] = 'N/A'
......
......@@ -115,10 +115,10 @@ class SimulatedPlatform:
if node.service_fits(service):
candidate_nodes.append(node)
else:
log.debug('Cannot fit service {} on node {}: {}'.format(service.id, node.name, node.service_why_unfit(service)))
log.debug('Cannot fit essential service {} on node {}: {}'.format(service.id, node.name, node.service_why_unfit(service)))
if len(candidate_nodes) == 0: # this service does not fit anywhere
self.deallocate_essential(execution)
log.debug('Cannot fit essential service {} anywhere, bailing out'.format(service.id))
log.info('Cannot fit essential service {} anywhere, bailing out'.format(service.id))
return False
candidate_nodes.sort(key=lambda n: n.container_count) # smallest first
candidate_nodes[0].service_add(service)
......@@ -141,7 +141,10 @@ class SimulatedPlatform:
for node_id_, node in self.nodes.items():
if node.service_fits(service):
candidate_nodes.append(node)
else:
log.debug('Cannot fit elastic service {} on node {}: {}'.format(service.id, node.name, node.service_why_unfit(service)))
if len(candidate_nodes) == 0: # this service does not fit anywhere
log.info('Cannot fit elastic service {} anywhere'.format(service.id))
continue
candidate_nodes.sort(key=lambda n: n.container_count) # smallest first
candidate_nodes[0].service_add(service)
......
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