Exemplo n.º 1
0
    def preprocess_args(
        cls,
        groupid,
        topic,
        partitions,
        cluster_config,
        client,
        fail_on_error=True,
        force=False,
        topics=None,
        use_admin_client=False,
    ):
        topics_dict = super(OffsetWriter, cls).preprocess_args(
            groupid,
            topic,
            partitions,
            cluster_config,
            client,
            fail_on_error=(fail_on_error and not force),
            topics=topics,
            use_admin_client=use_admin_client,
        )

        if not topics_dict and force:
            topics_dict = cls.get_forced_topic_partitions(
                groupid,
                topic,
                partitions,
                client,
            )

        topics_str = ""
        for local_topic, local_partitions in six.iteritems(topics_dict):
            temp_str = "Topic: {topic}, Partitions: {partitions}\n".format(
                topic=local_topic,
                partitions=local_partitions
            )
            topics_str = topics_str + temp_str

        if (not topic) or (not partitions):
            in_str = (
                "Offsets of all topics and partitions listed below "
                "shall be modified:\n{topics}\nIs this what you really "
                "intend? (y/n)".format(topics=topics_str)
            )
            prompt_user_input(in_str)

        return topics_dict
Exemplo n.º 2
0
    def preprocess_args(
        cls,
        groupid,
        topic,
        partitions,
        cluster_config,
        client,
        fail_on_error=True,
        force=False,
        topics=None,
    ):
        topics_dict = super(OffsetWriter, cls).preprocess_args(
            groupid,
            topic,
            partitions,
            cluster_config,
            client,
            fail_on_error=(fail_on_error and not force),
            topics=topics,
        )

        if not topics_dict and force:
            topics_dict = cls.get_forced_topic_partitions(
                groupid,
                topic,
                partitions,
                client,
            )

        topics_str = ""
        for local_topic, local_partitions in six.iteritems(topics_dict):
            temp_str = "Topic: {topic}, Partitions: {partitions}\n".format(
                topic=local_topic,
                partitions=local_partitions
            )
            topics_str = topics_str + temp_str

        if (not topic) or (not partitions):
            in_str = (
                "Offsets of all topics and partitions listed below "
                "shall be modified:\n{topics}\nIs this what you really "
                "intend? (y/n)".format(topics=topics_str)
            )
            prompt_user_input(in_str)

        return topics_dict