Whether the topic partition is currently paused.

 @see #pause
 @param topic [String]
 @param partition [Integer]
 @return [Boolean] true if the partition is paused, false otherwise.
183548
def paused?(topic, partition)
      pause = pause_for(topic, partition)
      pause.paused? && !pause.expired?
    end
544482
def commit_partition_offsets(self, partition_offsets):
        
        self.logger.debug("Committing partition offsets: %s", partition_offsets)

        commit_requests = [
            OffsetCommitRequestPayload(self.consumer.topic, partition, offset, None)
            for partition, offset in partition_offsets.items()
        ]
        commit_responses = self.consumer.client.send_offset_commit_request(
            self.consumer.group,
            commit_requests,
        )
        for commit_response in commit_responses:
            check_error(commit_response)
334779
@Then("^A kafka topic named '(.+?)' exists")
    public void kafkaTopicExist(String topic_name) throws KeeperException, InterruptedException {
        assert commonspec.getKafkaUtils().getZkUtils().pathExists("/" + topic_name) : "There is no topic with that name";
    }
465255
def _get_leader_for_partition(self, topic, partition):
        

        key = TopicAndPartition(topic, partition)
        # reload metadata whether the partition is not available
        # or has no leader (broker is None)
        if self.topics_to_brokers.get(key) is None:
            yield self.load_metadata_for_topics(topic)

        if key not in self.topics_to_brokers:
            raise PartitionUnavailableError("%s not available" % str(key))

        returnValue(self.topics_to_brokers[key])
1273776
def exist_partitions(self, prefix_spec=None):
        
        try:
            next(self.partitions.iterate_partitions(spec=prefix_spec))
        except StopIteration:
            return False
        return True
238082
def count_partitions(self, topic):
        """"""
        return sum(1 for p in topic.partitions if p in self.partitions)
1041319
def resume(list)
      unless list.is_a?(TopicPartitionList)
        raise TypeError.new("list has to be a TopicPartitionList")
      end
      tpl = list.to_native_tpl
      response = Rdkafka::Bindings.rd_kafka_resume_partitions(@native_kafka, tpl)
      if response != 0
        raise Rdkafka::RdkafkaError.new(response, "Error resume '#{list.to_h}'")
      end
    end
424441
def pause(expected = nil)
      paused = listener.paused?
      states = { paused: true, unpaused: false, toggle: !paused }
      pause = states[expected || :toggle]
      fail ArgumentError, "invalid mode: #{expected.inspect}" if pause.nil?
      return if pause == paused

      listener.public_send(pause ? :pause : :start)
      UI.info "File event handling has been #{pause ? 'paused' : 'resumed'}"
    end
1232428
public boolean commit(String topic) {
        KafkaConsumer<String, byte[]> consumer = _getConsumer(topic);
        synchronized (consumer) {
            Set<String> subscription = consumer.subscription();
            if (subscription == null || !subscription.contains(topic)) {
                // this consumer has not subscribed to the topic
                return false;
            }
            try {
                consumer.commitSync();
            } catch (WakeupException e) {
            } catch (Exception e) {
                throw new KafkaException(e);
            }
            return true;
        }
    }
991774
def pause_multiple(self, infohash_list):
        
        data = self._process_infohash_list(infohash_list)
        return self._post('command/pauseAll', data=data)
1051258
def seek_to_beginning(self, topic_partition=None):
        

        if isinstance(topic_partition, TopicPartition):
            self.consumer.seek_to_beginning(topic_partition)
        else:
            raise TypeError("topic_partition must be of type TopicPartition, create it with Create TopicPartition keyword.")
724710
public boolean commitAsync(String topic) {
        KafkaConsumer<String, byte[]> consumer = _getConsumer(topic);
        synchronized (consumer) {
            Set<String> subscription = consumer.subscription();
            if (subscription == null || !subscription.contains(topic)) {
                // this consumer has not subscribed to the topic
                return false;
            }
            try {
                consumer.commitAsync(new OffsetCommitCallback() {
                    @Override
                    public void onComplete(Map<TopicPartition, OffsetAndMetadata> offsets,
                            Exception e) {
                        if (e != null) {
                            LOGGER.error(e.getMessage(), e);
                        }
                    }
                });
            } catch (WakeupException e) {
            } catch (Exception e) {
                throw new KafkaException(e);
            }
            return true;
        }
    }
158133
@Override
    public boolean isPaused(String targets) throws PauseableComponentControllerRequestFailedException {

        Set<String> foundTargets = new HashSet<String>();

        Set<String> targetList = createTargetList(targets);

        if (targetList.isEmpty()) {
            Tr.warning(tc, "warning.server.status.invalid.targets");
            throw new PauseableComponentControllerRequestFailedException(Tr.formatMessage(tc, "warning.server.status.invalid.targets"));
        }

        //Add each pauseable component to this list. If the tracked values get modified
        //while we are iterating and we start over, skip anyone already in this list
        Set<PauseableComponent> processedList = new HashSet<PauseableComponent>();

        // Sync with other methods changing/querying states for PauseableComponents
        synchronized (this) {
            while (true) {
                try {
                    for (PauseableComponent pauseableComponent : tracker.getTracked().values()) {

                        if (processedList.add(pauseableComponent)) {

                            if (targetList.contains(pauseableComponent.getName())) {
                                foundTargets.add(pauseableComponent.getName());

                                if (!pauseableComponent.isPaused()) {
                                    return false;
                                }
                            }
                        }
                    }

                    break;
                } catch (Throwable t) {
                    // Someone modified our list of services. Retry.
                }
            }
        }

        //Check which (if any) targets were not found
        targetList.removeAll(foundTargets);
        if (!targetList.isEmpty()) {
            // We could not find targets specified. Return false: not everyone was paused
            Tr.warning(tc, "warning.server.status.missing.targets", Arrays.toString(targetList.toArray()));
            throw new PauseableComponentControllerRequestFailedException(Tr.formatMessage(tc, "warning.server.status.missing.targets", Arrays.toString(targetList.toArray())));

        } else {
            return true;
        }

    }
1017
def _pause_all_nodes(self, max_thread_pool_size=0):
        
        failed = 0

        def _pause_specific_node(node):
            if not node.instance_id:
                log.warning("Node `%s` has no instance id."
                            " It is either already stopped, or"
                            " never created properly.  Not attempting"
                            " to stop it again.", node.name)
                return None
            try:
                return node.pause()
            except Exception as err:
                log.error(
                    "Could not stop node `%s` (instance ID `%s`): %s %s",
                    node.name, node.instance_id, err, err.__class__)
                node.update_ips()
                return None

        nodes = self.get_all_nodes()
        thread_pool = self._make_thread_pool(max_thread_pool_size)
        for node, state in zip(nodes, thread_pool.map(_pause_specific_node, nodes)):
            if state is None:
                failed += 1
            else:
                self.paused_nodes[node.name] = state

        return failed
252105
public static boolean containsPartitionAvgRecordMillis(State state, KafkaPartition partition) {
    return state.contains(
        getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS);
  }
628395
def partitions_for(self, topic):
        """"""
        max_wait = self.config['max_block_ms'] / 1000.0
        return self._wait_on_metadata(topic, max_wait)
505978
def is_topic_tail(self):
        
        return self.topic.last_post.id == self.id if self.topic.last_post else False