예제 #1
0
 def activate(self,
              idx,
              probe_seconds=0,
              launch=True,
              daemon=False,
              delay=False,
              **kwargs):
     sta = self.hdls[idx]
     assert sta is None
     cfg = self.net_config.get_node_cfg(idx)
     cfg["AdministrationNode"] = self.admin_node.Address
     log_config = self.validator_log_config
     if log_config is not None:
         log_config = self.validator_log_config.copy()
     v = ValidatorManager(
         self.txnvalidator,
         cfg,
         self.data_dir,
         self.admin_node,
         log_config,
         static_node=True,
     )
     print('launching %s...' % (v.name), end=' ')
     v.launch(launch, daemon=daemon, delay=delay)
     if probe_seconds > 0:
         self.probe_validator(v, max_time=probe_seconds)
     else:
         print()
     self.hdls[idx] = v
     return v
    def launch_node(self,
                    overrides=None,
                    launch=True,
                    genesis=False,
                    daemon=False,
                    delay=False):
        id = self.NextValidatorId
        self.NextValidatorId += 1
        cfg = self.ValidatorConfig.copy()
        if overrides:
            cfg.update(overrides)
        cfg['id'] = id
        cfg['NodeName'] = "validator-{}".format(id)
        cfg['HttpPort'] = self.HttpPortBase + id
        cfg['Port'] = self.UdpPortBase + id
        log_config = self.validator_log_config.copy() \
            if self.validator_log_config \
            else None

        v = ValidatorManager(self.txnvalidator, cfg, self.DataDir,
                             self.AdminNode, log_config)
        v.launch(launch, genesis=genesis, daemon=daemon, delay=delay)
        self.Validators.append(v)
        self.ValidatorMap[id] = v
        self.ValidatorMap[cfg['NodeName']] = v
        return v
예제 #3
0
 def activate(self,
              idx,
              probe_seconds=30,
              launch=True,
              daemon=False,
              delay=False,
              **kwargs):
     [sta, cfg] = self._validators[idx]
     assert sta is None
     cfg['DataDirectory'] = self.data_dir
     cfg["AdministrationNode"] = self.admin_node.Address
     cfg['Restore'] = False
     log_config = self.validator_log_config
     if log_config is not None:
         log_config = self.validator_log_config.copy()
     v = ValidatorManager(
         self.txnvalidator,
         cfg,
         self.data_dir,
         self.admin_node,
         log_config,
         static_node=True,
     )
     print 'launching %s...' % (v.name),
     v.launch(launch, daemon=daemon, delay=delay)
     if probe_seconds > 0:
         self.probe_validator(v, max_time=probe_seconds)
     else:
         print
     self._validators[idx][0] = v
     return v
 def activate(self, idx,
              probe_seconds=0,
              launch=True,
              daemon=False,
              delay=False,
              **kwargs
              ):
     sta = self.hdls[idx]
     assert sta is None
     cfg = self.net_config.get_node_cfg(idx)
     cfg["AdministrationNode"] = self.admin_node.Address
     log_config = self.validator_log_config
     if log_config is not None:
         log_config = self.validator_log_config.copy()
     v = ValidatorManager(self.txnvalidator,
                          cfg,
                          self.data_dir,
                          self.admin_node,
                          log_config,
                          static_node=True,
                          )
     print('launching %s...' % (v.name), end=' ')
     v.launch(launch, daemon=daemon, delay=delay)
     if probe_seconds > 0:
         self.probe_validator(v, max_time=probe_seconds)
     else:
         print()
     self.hdls[idx] = v
     return v
 def activate(self, idx,
              probe_seconds=30,
              launch=True,
              daemon=False,
              delay=False,
              **kwargs
              ):
     [sta, cfg] = self._validators[idx]
     assert sta is None
     cfg['DataDirectory'] = self.data_dir
     cfg["AdministrationNode"] = self.admin_node.Address
     cfg['Restore'] = False
     log_config = self.validator_log_config
     if log_config is not None:
         log_config = self.validator_log_config.copy()
     v = ValidatorManager(self.txnvalidator,
                          cfg,
                          self.data_dir,
                          self.admin_node,
                          log_config,
                          static_node=True,
                          )
     print 'launching %s...' % (v.name),
     v.launch(launch, daemon=daemon, delay=delay)
     if probe_seconds > 0:
         self.probe_validator(v, max_time=probe_seconds)
     else:
         print
     self._validators[idx][0] = v
     return v
예제 #6
0
    def launch_node(self,
                    overrides=None,
                    launch=True,
                    genesis=False,
                    daemon=False,
                    delay=False):
        validator_id = self._next_validator_id
        self._next_validator_id += 1
        cfg = self.validator_config.copy()
        if overrides:
            cfg.update(overrides)
        cfg['NodeName'] = "validator-{}".format(validator_id)
        if 'LedgerURL' not in cfg and\
                len(self._validators) != 0:
            cfg['LedgerURL'] = self._validators[0].url

        cfg['Listen'] = [
            '{0}:{1}/UDP gossip'.format(self._host,
                                        self._udp_port_base + validator_id),
            '{0}:{1}/TCP http'.format(self._host,
                                      self._http_port_base + validator_id)
        ]
        if self._endpoint_host:
            cfg['Endpoint'] = {
                "Host": self._endpoint_host,
                "Port": self._udp_port_base + validator_id,
                "HttpPort": self._http_port_base + validator_id
            }
        static_node = False

        if self.static_network is not None:
            assert 'Nodes' in cfg.keys()
            static_node = True
            nd = self.static_network.get_node(validator_id)
            q = self.static_network.get_quorum(validator_id,
                                               dfl=cfg.get('Quorum', []))
            cfg['NodeName'] = nd['NodeName']
            cfg['SigningKey'] = self.static_network.get_key(validator_id)
            cfg['Identifier'] = nd['Identifier']
            cfg['Quorum'] = q
        log_config = self.validator_log_config.copy() \
            if self.validator_log_config \
            else None
        v = ValidatorManager(self.txnvalidator,
                             cfg,
                             self.data_dir,
                             self.admin_node,
                             log_config,
                             static_node=static_node)
        v.launch(launch, genesis=genesis, daemon=daemon, delay=delay)
        self._validators.append(v)
        self._validator_map[validator_id] = v
        self._validator_map[cfg['NodeName']] = v
        return v
    def launch_node(self,
                    overrides=None,
                    launch=True,
                    genesis=False,
                    daemon=False,
                    delay=False):
        validator_id = self._next_validator_id
        self._next_validator_id += 1
        cfg = self.validator_config.copy()
        if overrides:
            cfg.update(overrides)
        cfg['id'] = validator_id
        cfg['NodeName'] = "validator-{}".format(validator_id)
        if 'LedgerURL' not in cfg and\
                len(self._validators) != 0:
            cfg['LedgerURL'] = self._validators[0].url

        cfg['Listen'] = [
            '{0}:{1}/UDP gossip'.format(self._host, self._udp_port_base +
                                        validator_id),
            '{0}:{1}/TCP http'.format(self._host, self._http_port_base +
                                      validator_id)
        ]
        if self._endpoint_host:
            cfg['Endpoint'] = {
                "Host": self._endpoint_host,
                "Port": self._udp_port_base + validator_id,
                "HttpPort": self._http_port_base + validator_id
            }
        static_node = False

        if self.static_network is not None:
            assert 'Nodes' in cfg.keys()
            static_node = True
            nd = self.static_network.get_node(validator_id)
            q = self.static_network.get_quorum(validator_id,
                                               dfl=cfg.get('Quorum', []))
            cfg['NodeName'] = nd['ShortName']
            cfg['SigningKey'] = self.static_network.get_key(validator_id)
            cfg['Identifier'] = nd['Identifier']
            cfg['Quorum'] = q
        log_config = self.validator_log_config.copy() \
            if self.validator_log_config \
            else None
        v = ValidatorManager(self.txnvalidator, cfg, self.data_dir,
                             self.admin_node, log_config,
                             static_node=static_node)
        v.launch(launch, genesis=genesis, daemon=daemon, delay=delay)
        self._validators.append(v)
        self._validator_map[validator_id] = v
        self._validator_map[cfg['NodeName']] = v
        return v
    def launch_node(self, launch=True):
        id = self.NextValidatorId
        self.NextValidatorId += 1
        cfg = self.ValidatorConfig.copy()
        cfg['id'] = id
        cfg['NodeName'] = "validator-{}".format(id)
        cfg['HttpPort'] = self.HttpPortBase + id
        cfg['Port'] = self.UdpPortBase + id

        v = ValidatorManager(self.txnvalidator, cfg, self.DataDir,
                             self.AdminNode)
        v.launch(launch)
        self.Validators.append(v)
        self.ValidatorMap[id] = v
        self.ValidatorMap[cfg['NodeName']] = v
        return v
    def launch_node(self, launch=True):
        id = self.NextValidatorId
        self.NextValidatorId += 1
        cfg = self.ValidatorConfig.copy()
        cfg['id'] = id
        cfg['NodeName'] = "validator-{}".format(id)
        cfg['HttpPort'] = self.HttpPortBase + id
        cfg['Port'] = self.UdpPortBase + id

        v = ValidatorManager(self.txnvalidator, cfg, self.DataDir,
                             self.AdminNode)
        v.launch(launch)
        self.Validators.append(v)
        self.ValidatorMap[id] = v
        self.ValidatorMap[cfg['NodeName']] = v
        return v
 def launch_node(self,
                 overrides=None,
                 launch=True,
                 genesis=False,
                 daemon=False,
                 delay=False):
     validator_id = self._next_validator_id
     self._next_validator_id += 1
     cfg = self.validator_config.copy()
     if overrides:
         cfg.update(overrides)
     cfg['id'] = validator_id
     cfg['NodeName'] = "validator-{}".format(validator_id)
     cfg['Listen'] = [
         'localhost:{0}/UDP gossip'.format(self.UdpPortBase + validator_id),
         'localhost:{0}/TCP http'.format(self.HttpPortBase + validator_id)
     ]
     static_node = False
     if self.staticNetwork is not None:
         assert 'Nodes' in cfg.keys()
         static_node = True
         nd = self.staticNetwork.get_node(validator_id)
         q = self.staticNetwork.get_quorum(validator_id,
                                           dfl=cfg.get('Quorum', []))
         cfg['NodeName'] = nd['ShortName']
         cfg['Listen'] = [
             'localhost:{0}/UDP gossip'.format(nd['Port']),
             'localhost:{0}/TCP http'.format(nd['HttpPort'])
         ]
         cfg['SigningKey'] = self.staticNetwork.get_key(validator_id)
         cfg['Identifier'] = nd['Identifier']
         cfg['Quorum'] = q
     log_config = self.validator_log_config.copy() \
         if self.validator_log_config \
         else None
     v = ValidatorManager(self.txnvalidator, cfg, self.data_dir,
                          self.AdminNode, log_config,
                          static_node=static_node)
     v.launch(launch, genesis=genesis, daemon=daemon, delay=delay)
     self._validators.append(v)
     self._validator_map[validator_id] = v
     self._validator_map[cfg['NodeName']] = v
     return v
 def launch_node(self, idx,
                 launch=True,
                 daemon=False,
                 delay=False,
                 ):
     cfg = self.config_list[idx]
     cfg['DataDirectory'] = self.data_dir
     cfg["AdministrationNode"] = self.admin_node.address
     cfg['Restore'] = False
     log_config = self.validator_log_config
     if log_config is not None:
         log_config = self.validator_log_config.copy()
     v = ValidatorManager(self.txnvalidator,
                          cfg,
                          self.data_dir,
                          self.admin_node,
                          log_config,
                          )
     v.launch(launch, daemon=daemon, delay=delay)
     self._validators.append(v)
     return v
 def launch_node(
     self,
     idx,
     launch=True,
     daemon=False,
     delay=False,
 ):
     cfg = self.config_list[idx]
     cfg['DataDirectory'] = self.data_dir
     cfg["AdministrationNode"] = self.admin_node.address
     log_config = self.validator_log_config
     if log_config is not None:
         log_config = self.validator_log_config.copy()
     v = ValidatorManager(
         self.txnvalidator,
         cfg,
         self.data_dir,
         self.admin_node,
         log_config,
     )
     v.launch(launch, daemon=daemon, delay=delay)
     self._validators.append(v)
     return v