Esempio n. 1
0
def config_containers_connections():
    configure_from_dict(
        dict(schematizer_host_and_port='schematizer:8888',
             kafka_zookeeper='zk:2181',
             kafka_broker_list=['kafka:9092'],
             should_use_testing_containers=True))
    yield
Esempio n. 2
0
def config_containers_connections():
    configure_from_dict(dict(
        schematizer_host_and_port='schematizer:8888',
        kafka_zookeeper='zk:2181',
        kafka_broker_list=['kafka:9092'],
        should_use_testing_containers=True
    ))
    yield
Esempio n. 3
0
    def use_testing_containers(self):
        """Configures the data pipeline clientlib to use the containers"""
        schematizer_ip = Containers.get_container_ip_address(self.project, 'schematizer')
        schematizer_host_and_port = "{}:8888".format(schematizer_ip)

        zookeeper_ip = Containers.get_container_ip_address(self.project, 'zookeeper')
        zookeeper_host_and_port = "{}:2181".format(zookeeper_ip)

        kafka_ip = Containers.get_container_ip_address(self.project, 'kafka')
        kafka_host_and_port = "{}:9092".format(kafka_ip)

        configure_from_dict(dict(
            schematizer_host_and_port=schematizer_host_and_port,
            kafka_zookeeper=zookeeper_host_and_port,
            kafka_broker_list=[kafka_host_and_port],
            should_use_testing_containers=True
        ))
Esempio n. 4
0
    def use_testing_containers(self):
        """Configures the data pipeline clientlib to use the containers"""
        schematizer_ip = Containers.get_container_ip_address(
            self.project, 'schematizer')
        schematizer_host_and_port = "{}:8888".format(schematizer_ip)

        zookeeper_ip = Containers.get_container_ip_address(
            self.project, 'zookeeper')
        zookeeper_host_and_port = "{}:2181".format(zookeeper_ip)

        kafka_ip = Containers.get_container_ip_address(self.project, 'kafka')
        kafka_host_and_port = "{}:9092".format(kafka_ip)

        configure_from_dict(
            dict(schematizer_host_and_port=schematizer_host_and_port,
                 kafka_zookeeper=zookeeper_host_and_port,
                 kafka_broker_list=[kafka_host_and_port],
                 should_use_testing_containers=True))
Esempio n. 5
0
def reconfigure(**kwargs):
    """Reconfigures the given kwargs, restoring the current configuration for
    only those kwargs when the contextmanager exits.
    """
    conf_namespace = staticconf.config.get_namespace(namespace)
    starting_config = {
        k: v for k, v in conf_namespace.get_config_values().iteritems()
        if k in kwargs
    }
    configure_from_dict(kwargs)
    try:
        yield
    finally:
        final_config = {
            k: v for k, v in conf_namespace.get_config_values().iteritems()
            if k not in kwargs
        }
        final_config.update(starting_config)
        staticconf.config.get_namespace(namespace).clear()
        configure_from_dict(final_config)
Esempio n. 6
0
def reconfigure(**kwargs):
    """Reconfigures the given kwargs, restoring the current configuration for
    only those kwargs when the contextmanager exits.
    """
    conf_namespace = staticconf.config.get_namespace(namespace)
    starting_config = {
        k: v
        for k, v in conf_namespace.get_config_values().iteritems()
        if k in kwargs
    }
    configure_from_dict(kwargs)
    try:
        yield
    finally:
        final_config = {
            k: v
            for k, v in conf_namespace.get_config_values().iteritems()
            if k not in kwargs
        }
        final_config.update(starting_config)
        staticconf.config.get_namespace(namespace).clear()
        configure_from_dict(final_config)