Run isolated heartbeat against all hosts at once

Previously we were running the playbook on a host-by-host
basis, but this changes it to pass in the list of all
isolated isntances the machine is responsible for.
Using the `json` Ansible stdout module, we are able to
parse the output for information on each host.
This commit is contained in:
AlanCoding
2017-06-19 12:07:40 -04:00
parent 7eb8fdd0f1
commit f371dd71b2
2 changed files with 23 additions and 17 deletions

View File

@@ -218,10 +218,9 @@ def tower_isolated_heartbeat(self):
return
cutoff_pk = UnifiedJob.lowest_running_id()
# Slow pass looping over isolated IGs and their isolated instances
for isolated_instance in isolated_instance_qs:
logger.debug("Managing isolated instance {}.".format(isolated_instance.hostname))
isolated_instance.capacity = isolated_manager.IsolatedManager.health_check(isolated_instance, cutoff_pk=cutoff_pk)
isolated_instance.save(update_fields=['capacity'])
if len(isolated_instance_qs) > 0:
logger.debug("Managing isolated instances {}.".format(','.join([inst.hostname for inst in isolated_instance_qs])))
isolated_manager.IsolatedManager.health_check(isolated_instance_qs, cutoff_pk=cutoff_pk)
@task(bind=True, queue='tower')