def start_kernel(self, **kw): """Starts a kernel process and configures the manager to use it. If random ports (port=0) are being used, this method must be called before the channels are created. Parameters: ----------- launcher : callable, optional (default None) A custom function for launching the kernel process (generally a wrapper around ``entry_point.base_launch_kernel``). In most cases, it should not be necessary to use this parameter. **kw : optional See respective options for IPython and Python kernels. """ if self.transport == 'tcp' and self.ip not in LOCAL_IPS: raise RuntimeError("Can only launch a kernel on a local interface. " "Make sure that the '*_address' attributes are " "configured properly. " "Currently valid addresses are: %s"%LOCAL_IPS ) # write connection file / get default ports self.write_connection_file() self._launch_args = kw.copy() launch_kernel = kw.pop('launcher', None) if launch_kernel is None: from ipkernel import launch_kernel self.kernel = launch_kernel(fname=self.connection_file, **kw)
def start_kernel(self, **kw): """Starts a kernel process and configures the manager to use it. If random ports (port=0) are being used, this method must be called before the channels are created. Parameters: ----------- ipython : bool, optional (default True) Whether to use an IPython kernel instead of a plain Python kernel. """ xreq, sub, rep, hb = self.xreq_address, self.sub_address, \ self.rep_address, self.hb_address if xreq[0] not in LOCAL_IPS or sub[0] not in LOCAL_IPS or \ rep[0] not in LOCAL_IPS or hb[0] not in LOCAL_IPS: raise RuntimeError("Can only launch a kernel on a local interface. " "Make sure that the '*_address' attributes are " "configured properly. " "Currently valid addresses are: %s"%LOCAL_IPS ) self._launch_args = kw.copy() if kw.pop('ipython', True): from ipkernel import launch_kernel else: from pykernel import launch_kernel self.kernel, xrep, pub, req, _hb = launch_kernel( xrep_port=xreq[1], pub_port=sub[1], req_port=rep[1], hb_port=hb[1], **kw) self.xreq_address = (xreq[0], xrep) self.sub_address = (sub[0], pub) self.rep_address = (rep[0], req) self.hb_address = (hb[0], _hb)
def start_kernel(self, **kw): """Starts a kernel process and configures the manager to use it. If random ports (port=0) are being used, this method must be called before the channels are created. Parameters: ----------- ipython : bool, optional (default True) Whether to use an IPython kernel instead of a plain Python kernel. """ xreq, sub, rep, hb = self.xreq_address, self.sub_address, \ self.rep_address, self.hb_address if xreq[0] not in LOCAL_IPS or sub[0] not in LOCAL_IPS or \ rep[0] not in LOCAL_IPS or hb[0] not in LOCAL_IPS: raise RuntimeError( "Can only launch a kernel on a local interface. " "Make sure that the '*_address' attributes are " "configured properly. " "Currently valid addresses are: %s" % LOCAL_IPS) self._launch_args = kw.copy() if kw.pop('ipython', True): from ipkernel import launch_kernel else: from pykernel import launch_kernel self.kernel, xrep, pub, req, _hb = launch_kernel(xrep_port=xreq[1], pub_port=sub[1], req_port=rep[1], hb_port=hb[1], **kw) self.xreq_address = (xreq[0], xrep) self.sub_address = (sub[0], pub) self.rep_address = (rep[0], req) self.hb_address = (hb[0], _hb)
def start_kernel(self, **kw): """Starts a kernel process and configures the manager to use it. If random ports (port=0) are being used, this method must be called before the channels are created. Parameters: ----------- launcher : callable, optional (default None) A custom function for launching the kernel process (generally a wrapper around ``entry_point.base_launch_kernel``). In most cases, it should not be necessary to use this parameter. **kw : optional See respective options for IPython and Python kernels. """ if self.ip not in LOCAL_IPS: raise RuntimeError( "Can only launch a kernel on a local interface. " "Make sure that the '*_address' attributes are " "configured properly. " "Currently valid addresses are: %s" % LOCAL_IPS) # write connection file / get default ports self.write_connection_file() self._launch_args = kw.copy() launch_kernel = kw.pop('launcher', None) if launch_kernel is None: from ipkernel import launch_kernel self.kernel = launch_kernel(fname=self.connection_file, **kw)
def start_kernel(self, **kw): """Starts a kernel process and configures the manager to use it. If random ports (port=0) are being used, this method must be called before the channels are created. Parameters: ----------- ipython : bool, optional (default True) Whether to use an IPython kernel instead of a plain Python kernel. launcher : callable, optional (default None) A custom function for launching the kernel process (generally a wrapper around ``entry_point.base_launch_kernel``). In most cases, it should not be necessary to use this parameter. **kw : optional See respective options for IPython and Python kernels. """ shell, sub, stdin, hb = self.shell_address, self.sub_address, \ self.stdin_address, self.hb_address if shell[0] not in LOCAL_IPS or sub[0] not in LOCAL_IPS or \ stdin[0] not in LOCAL_IPS or hb[0] not in LOCAL_IPS: raise RuntimeError("Can only launch a kernel on a local interface. " "Make sure that the '*_address' attributes are " "configured properly. " "Currently valid addresses are: %s"%LOCAL_IPS ) self._launch_args = kw.copy() launch_kernel = kw.pop('launcher', None) if launch_kernel is None: if kw.pop('ipython', True): from ipkernel import launch_kernel else: from pykernel import launch_kernel self.kernel, xrep, pub, req, _hb = launch_kernel( shell_port=shell[1], iopub_port=sub[1], stdin_port=stdin[1], hb_port=hb[1], **kw) self.shell_address = (shell[0], xrep) self.sub_address = (sub[0], pub) self.stdin_address = (stdin[0], req) self.hb_address = (hb[0], _hb)