def block_until_ready(self, deployment_str, dashi): """Blocks until all of the services in a deployment are contacted """ deployment = parse_deployment(yaml_str=deployment_str) for provisioner_name in deployment.get('provisioners', {}).iterkeys(): provisioner = ProvisionerClient(dashi, topic=provisioner_name) self._block_on_call(provisioner.describe_nodes) for epum_name in deployment.get('epums', {}).iterkeys(): epum = EPUManagementClient(dashi, epum_name) self._block_on_call(epum.list_domains) for node in deployment.get('nodes', {}).itervalues(): for eeagent_name in node.get('eeagents', {}).iterkeys(): eeagent = EEAgentClient(dashi=dashi, ee_name=eeagent_name, handle_heartbeat=False) self._block_on_call(eeagent.dump, kwargs={'rpc': True}) for pd_name in deployment.get('process-dispatchers', {}).iterkeys(): pd = ProcessDispatcherClient(dashi, pd_name) self._block_on_call(pd.describe_processes) for dt_name in deployment.get('dt_registries', {}).iterkeys(): dtrs = DTRSClient(dashi, topic=dt_name) self._block_on_call(dtrs.list_sites)
def get_clients(self, deployment_str, dashi): """returns a dictionary of epu clients, indexed by their topic name """ deployment = parse_deployment(yaml_str=deployment_str) clients = {} for provisioner_name in deployment.get('provisioners', {}).iterkeys(): client = ProvisionerClient(dashi, topic=provisioner_name) clients[provisioner_name] = client for epum_name in deployment.get('epums', {}).iterkeys(): client = EPUManagementClient(dashi, epum_name) clients[epum_name] = client for node in deployment.get('nodes', {}).itervalues(): for eeagent_name in node.get('eeagents', {}).iterkeys(): client = EEAgentClient(dashi=dashi, ee_name=eeagent_name, handle_heartbeat=False) clients[eeagent_name] = client for pd_name in deployment.get('process-dispatchers', {}).iterkeys(): client = ProcessDispatcherClient(dashi, pd_name) clients[pd_name] = client for dt_name in deployment.get('dt_registries', {}).iterkeys(): client = DTRSClient(dashi, topic=dt_name) clients[dt_name] = client return clients