예제 #1
0
def step_impl3(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        current_config = zk.get_topic_config(context.topic)
        current_config['config']['max.message.bytes'] = '1000'
        zk.set_topic_config(context.topic, value=current_config)
    time.sleep(2)  # sleeping for 2 seconds to ensure config is actually picked up
예제 #2
0
def step_impl5(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
        new_offsets = zk.get_group_offsets(NEW_GROUP)
    assert context.topic in offsets
    assert new_offsets == offsets
예제 #3
0
def fetch_offsets(group, topics):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(client, group, topics, False)
    client.close()
    return offsets
예제 #4
0
def fetch_offsets(group, topics):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(client, group, topics, False)
    client.close()
    return offsets
예제 #5
0
def step_impl3(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        current_config = zk.get_topic_config(context.topic)
        current_config['config']['max.message.bytes'] = '1000'
        zk.set_topic_config(context.topic, value=current_config)
    time.sleep(
        2)  # sleeping for 2 seconds to ensure config is actually picked up
예제 #6
0
def step_impl5(context):
    config = get_cluster_config()
    context.client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(
        context.client,
        context.group,
        [context.topic],
    )
    assert offsets[context.topic][0] == 0
예제 #7
0
def step_impl3(context):
    config = get_cluster_config()
    context.client = KafkaToolClient(config.broker_list)
    offsets = get_current_consumer_offsets(
        context.client,
        context.group,
        [context.topic],
    )
    assert offsets[context.topic][0] == SET_OFFSET_KAFKA
예제 #8
0
def commit_offsets(offsets, group):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    set_consumer_offsets(
        client,
        group,
        offsets,
    )
    client.close()
예제 #9
0
def commit_offsets(offsets, group):
    # Setup the Kafka client
    config = get_cluster_config()
    client = KafkaToolClient(config.broker_list)
    set_consumer_offsets(
        client,
        group,
        offsets,
    )
    client.close()
예제 #10
0
def set_min_isr(topic, min_isr):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        config = zk.get_topic_config(topic)
        config['config'] = {ISR_CONF_NAME: str(min_isr)}
        zk.set_topic_config(topic, config)
예제 #11
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == RESTORED_OFFSET
    context.offsets_file.close()
예제 #12
0
def step_impl3(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == SET_OFFSET
예제 #13
0
파일: min_isr.py 프로젝트: Yelp/kafka-utils
def set_min_isr(topic, min_isr):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        config = zk.get_topic_config(topic)
        config['config'] = {ISR_CONF_NAME: str(min_isr)}
        zk.set_topic_config(topic, config)
예제 #14
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert context.topic not in offsets
예제 #15
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == context.msgs_produced
예제 #16
0
def step_impl4(context):
    cluster_config = get_cluster_config()
    with ZK(cluster_config) as zk:
        offsets = zk.get_group_offsets(context.group)
    assert offsets[context.topic]["0"] == context.msgs_produced