

def _connect(self, sshserver, ssh_kwargs, timeout):
    'setup all our socket connections to the cluster. This is called from\n        __init__.'
    if self._connected:
        return
    self._connected = True

    def connect_socket(s, url):
        url = util.disambiguate_url(url, self._config['location'])
        if self._ssh:
            return tunnel.tunnel_connection(s, url, sshserver, **ssh_kwargs)
        else:
            return s.connect(url)
    self.session.send(self._query_socket, 'connection_request')
    poller = zmq.Poller()
    poller.register(self._query_socket, zmq.POLLIN)
    evts = poller.poll((timeout * 1000))
    if (not evts):
        raise error.TimeoutError('Hub connection request timed out')
    (idents, msg) = self.session.recv(self._query_socket, mode=0)
    if self.debug:
        pprint(msg)
    msg = Message(msg)
    content = msg.content
    self._config['registration'] = dict(content)
    if (content.status == 'ok'):
        ident = util.asbytes(self.session.session)
        if content.mux:
            self._mux_socket = self._context.socket(zmq.XREQ)
            self._mux_socket.setsockopt(zmq.IDENTITY, ident)
            connect_socket(self._mux_socket, content.mux)
        if content.task:
            (self._task_scheme, task_addr) = content.task
            self._task_socket = self._context.socket(zmq.XREQ)
            self._task_socket.setsockopt(zmq.IDENTITY, ident)
            connect_socket(self._task_socket, task_addr)
        if content.notification:
            self._notification_socket = self._context.socket(zmq.SUB)
            connect_socket(self._notification_socket, content.notification)
            self._notification_socket.setsockopt(zmq.SUBSCRIBE, b'')
        if content.control:
            self._control_socket = self._context.socket(zmq.XREQ)
            self._control_socket.setsockopt(zmq.IDENTITY, ident)
            connect_socket(self._control_socket, content.control)
        if content.iopub:
            self._iopub_socket = self._context.socket(zmq.SUB)
            self._iopub_socket.setsockopt(zmq.SUBSCRIBE, b'')
            self._iopub_socket.setsockopt(zmq.IDENTITY, ident)
            connect_socket(self._iopub_socket, content.iopub)
        self._update_engines(dict(ssh_kwargs.engines))
    else:
        self._connected = False
        raise Exception('Failed to connect!')

dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/client/client.py Client._connect/VarMisuse@509/692 `content`->`ssh_kwargs`