예제 #1
0
    def update_from_cluster(self, topic: Topic):
        """Takes a topic and, based on its name, updates all attributes from the cluster"""

        confluent_topic: ConfluentTopic = self._get_client_topic(
            topic.name, ClientTypes.Confluent)
        pykafka_topic: PyKafkaTopic = self._get_client_topic(
            topic.name, ClientTypes.PyKafka)
        low_watermarks = pykafka_topic.earliest_available_offsets()
        high_watermarks = pykafka_topic.latest_available_offsets()

        topic.partition_data = self._get_partition_data(
            confluent_topic, low_watermarks, high_watermarks, topic)
        topic.config = self.cluster.retrieve_config(ConfigResource.Type.TOPIC,
                                                    topic.name)

        topic.is_only_local = False

        return topic
예제 #2
0
    def update_from_cluster(
            self,
            topic: Topic,
            *,
            retrieve_last_timestamp: bool = False,
            retrieve_partition_watermarks: bool = True) -> Topic:
        """Takes a topic and, based on its name, updates all attributes from the cluster"""

        topic.partition_data = self._get_partitions(
            topic,
            retrieve_last_timestamp,
            get_partition_watermarks=retrieve_partition_watermarks)
        topic.config = self.cluster.retrieve_config(ConfigResource.Type.TOPIC,
                                                    topic.name)

        topic.is_only_local = False

        return topic