def connect(self, raise_on_any_error=False):
        results = {}

        for host in self._hosts:
            while not self._pool.free():
                eventlet.sleep(self._scan_interval)
            self._pool.spawn(self._connect, host=host, results=results,
                             raise_on_any_error=raise_on_any_error)

        self._pool.waitall()

        if self._successful_connects < 1:
            # We definitely have to raise an exception in this case.
            LOG.error('Unable to connect to any of the hosts.',
                      extra={'connect_results': results})
            msg = ('Unable to connect to any one of the hosts: %s.\n\n connect_errors=%s' %
                   (self._hosts, json.dumps(results, indent=2)))
            raise NoHostsConnectedToException(msg)

        return results
Connect to hosts in hosts list. Returns status of connect as a dict.
dataset/ETHPy150Open StackStorm/st2/st2actions/st2actions/runners/ssh/parallel_ssh.py/ParallelSSHClient.connect