environment/lib/python2.7/site-packages/IPython/parallel/apps/ipcontrollerapp.py
def load_config_from_json(self):
        """load config from existing json connector files."""
        c = self.config
        self.log.debug("loading config from JSON")
        # load from engine config
        fname = os.path.join(self.profile_dir.security_dir, self.engine_json_file)
        self.log.info("loading connection info from %s", fname)
        with open(fname) as f:
            cfg = json.loads(f.read())
        key = cfg['exec_key']
        # json gives unicode, Session.key wants bytes
        c.Session.key = key.encode('ascii')
        xport,addr = cfg['url'].split('://')
        c.HubFactory.engine_transport = xport
        ip,ports = addr.split(':')
        c.HubFactory.engine_ip = ip
        c.HubFactory.regport = int(ports)
        self.location = cfg['location']
        if not self.engine_ssh_server:
            self.engine_ssh_server = cfg['ssh']
        # load client config
        fname = os.path.join(self.profile_dir.security_dir, self.client_json_file)
        self.log.info("loading connection info from %s", fname)
        with open(fname) as f:
            cfg = json.loads(f.read())
        assert key == cfg['exec_key'], "exec_key mismatch between engine and client keys"
        xport,addr = cfg['url'].split('://')
        c.HubFactory.client_transport = xport
        ip,ports = addr.split(':')
        c.HubFactory.client_ip = ip
        if not self.ssh_server:
            self.ssh_server = cfg['ssh']
        assert int(ports) == c.HubFactory.regport, "regport mismatch"
def load_config_from_json(self):
        c = self.config
        self.log.debug("loading config from JSON")
        # load from engine config
        fname = os.path.join(self.profile_dir.security_dir, self.engine_json_file)
        self.log.info("loading connection info from %s", fname)
        with open(fname) as f:
            cfg = json.loads(f.read())
        key = cfg['exec_key']
        # json gives unicode, Session.key wants bytes
        c.Session.key = key.encode('ascii')
        xport,addr = cfg['url'].split('://')
        c.HubFactory.engine_transport = xport
        ip,ports = addr.split(':')
        c.HubFactory.engine_ip = ip
        c.HubFactory.regport = int(ports)
        self.location = cfg['location']
        if not self.engine_ssh_server:
            self.engine_ssh_server = cfg['ssh']
        # load client config
        fname = os.path.join(self.profile_dir.security_dir, self.client_json_file)
        self.log.info("loading connection info from %s", fname)
        with open(fname) as f:
            cfg = json.loads(f.read())
        assert key == cfg['exec_key'], "exec_key mismatch between engine and client keys"
        xport,addr = cfg['url'].split('://')
        c.HubFactory.client_transport = xport
        ip,ports = addr.split(':')
        c.HubFactory.client_ip = ip
        if not self.ssh_server:
            self.ssh_server = cfg['ssh']
        assert int(ports) == c.HubFactory.regport, "regport mismatch"
def load_config_from_json ( self ) : c = self . config self . log . debug ( "loading config from JSON" ) # load from engine config fname = os . path . join ( self . profile_dir . security_dir , self . engine_json_file ) self . log . info ( "loading connection info from %s" , fname ) with open ( fname ) as f : cfg = json . loads ( f . read ( ) ) key = cfg [ 'exec_key' ] # json gives unicode, Session.key wants bytes c . Session . key = key . encode ( 'ascii' ) xport , addr = cfg [ 'url' ] . split ( '://' ) c . HubFactory . engine_transport = xport ip , ports = addr . split ( ':' ) c . HubFactory . engine_ip = ip c . HubFactory . regport = int ( ports ) self . location = cfg [ 'location' ] if not self . engine_ssh_server : self . engine_ssh_server = cfg [ 'ssh' ] # load client config fname = os . path . join ( self . profile_dir . security_dir , self . client_json_file ) self . log . info ( "loading connection info from %s" , fname ) with open ( fname ) as f : cfg = json . loads ( f . read ( ) ) assert key == cfg [ 'exec_key' ] , "exec_key mismatch between engine and client keys" xport , addr = cfg [ 'url' ] . split ( '://' ) c . HubFactory . client_transport = xport ip , ports = addr . split ( ':' ) c . HubFactory . client_ip = ip if not self . ssh_server : self . ssh_server = cfg [ 'ssh' ] assert int ( ports ) == c . HubFactory . regport , "regport mismatch"
load config from existing json connector files.
load config from existing json connector files .