Example #1
0
    def __init__(self, skale, node_id=None):
        self.agent_name = self.__class__.__name__
        init_agent_logger(self.agent_name, node_id)
        self.logger = logging.getLogger(__name__)

        self.logger.info(f'Initialization of {self.agent_name} ...')
        if node_id is None:
            self.id = self.get_id_from_config(NODE_CONFIG_FILEPATH)
            self.is_test_mode = False
        else:
            self.id = node_id
            self.is_test_mode = True
        self.skale = skale
        if not check_node_id(self.skale, self.id):
            err_msg = f'There is no Node with ID = {self.id} in SKALE manager'
            self.logger.error(err_msg)
            raise NodeNotFoundException(err_msg)
        self.logger.info(f'Node ID = {self.id}')
        self.logger.info(f'Initialization of {self.agent_name} is completed')
Example #2
0
def test_check_node_id():
    assert check_node_id(skale, cur_node_id)
    assert check_node_id(skale, cur_node_id + 1)
    assert not check_node_id(skale, 100)