Exemple #1
0
    def __init__(self, input_file, logger_config):
        """
            Init function for the KafkaTopology class
            Args:
                input_file - file containing information about
                             kind of hosts on which the failure must
                             be induced , zookeeper paths and zookeeper
                             connection
                logger_config - configuration for logger
            Return:
                None
            Raise:
                None
        """
        TopologyBuilder.__init__(self, input_file, logger_config)

        with open(self.input_file, 'r') as file_descr:
            doc = yaml.load(file_descr)

        # Declaring the config variables
        self.plan = []
        self.zookeeper = None
        self.zookeeper_paths = None
        self.kafka_host_resolution = None
        self.resolved_topology = []

        # initializing Logger
        self.logger_instance = Logger(self.logger_config)

        # Reading from the config
        for key, val in doc.iteritems():
            setattr(self, key, val)

        # setup the zookeeper client
        if self.zookeeper:
            zook = KazooClient(hosts=self.zookeeper.get("host"),
                               read_only=True)
            zook.start()

            # read ZK Paths into a dictionary
            zk_paths = {}
            if self.zookeeper_paths:
                for path_type, path in self.zookeeper_paths.items():
                    zk_paths[path_type] = path
            # create zk_helper object
            helper = KafkaZkHelper(zook, zk_paths)
            self.helper = helper
        self.generate_plan()
Exemple #2
0
    def __init__(self, input_file, logger_config):
        """
            Init function for the KafkaTopology class
            Args:
                input_file - file containing information about
                             kind of hosts on which the failure must
                             be induced , zookeeper paths and zookeeper
                             connection
                logger_config - configuration for logger
            Return:
                None
            Raise:
                None
        """
        TopologyBuilder.__init__(self, input_file, logger_config)

        with open(self.input_file, "r") as file_descr:
            doc = yaml.load(file_descr)

        # Declaring the config variables
        self.plan = []
        self.zookeeper = None
        self.zookeeper_paths = None
        self.kafka_host_resolution = None
        self.resolved_topology = []

        # initializing Logger
        self.logger_instance = Logger(self.logger_config)

        # Reading from the config
        for key, val in doc.iteritems():
            setattr(self, key, val)

        # setup the zookeeper client
        if self.zookeeper:
            zook = KazooClient(hosts=self.zookeeper.get("host"), read_only=True)
            zook.start()

            # read ZK Paths into a dictionary
            zk_paths = {}
            if self.zookeeper_paths:
                for path_type, path in self.zookeeper_paths.items():
                    zk_paths[path_type] = path
            # create zk_helper object
            helper = KafkaZkHelper(zook, zk_paths)
            self.helper = helper
        self.generate_plan()
Exemple #3
0
    def __init__(self, input_file, logger_config):
        """
            The init function, reads the server list from the config file
            Args:
                input_file - config file path
                logger_config - configuration for logger
            Return:
                None
            Raise:
                None
        """
        TopologyBuilder.__init__(self, input_file, logger_config)
        self.resolved_topology = []
        self.topology = None
        with open(self.input_file, 'r') as file_desc:
            doc = yaml.load(file_desc)

        for key, val in doc.iteritems():
            setattr(self, key, val)

        self.populate_topology()
Exemple #4
0
    def __init__(self, input_file, logger_config):
        """
            Init function, reads the config containing server list
            Args:
                input_file - A yaml file containing a key nodes
                    containing the server list
                logger_config - configuration for logger
            Return:
                None
            Raise:
                None
        """
        TopologyBuilder.__init__(self, input_file, logger_config)
        self.resolved_topology = []
        self.topology = None

        with open(self.input_file, "r") as file_desc:
            doc = yaml.load(file_desc)

        for key, val in doc.iteritems():
            setattr(self, key, val)

        self.populate_topology()