Modify partitions in a Kafka topic.

@param topic_name    topic name
@param numPartitions number of partitions
977801
@When("^I increase '(.+?)' partitions in a Kafka topic named '(.+?)'")
    public void modifyPartitions(int numPartitions, String topic_name) throws Exception {
        commonspec.getKafkaUtils().modifyTopicPartitioning(topic_name, numPartitions);
    }
676035
def set_topics(self, topics):
        
        if set(topics).difference(self._topics):
            future = self.cluster.request_update()
        else:
            future = Future().success(set(topics))
        self._topics = set(topics)
        return future
628395
def partitions_for(self, topic):
        """"""
        max_wait = self.config['max_block_ms'] / 1000.0
        return self._wait_on_metadata(topic, max_wait)
96880
private static List<Short> partitionsForVbids(int numPartitions, Short... vbids) {
    if (vbids.length > 0) {
      Arrays.sort(vbids);
      return Arrays.asList(vbids);
    }

    List<Short> partitions = new ArrayList<>(vbids.length);
    for (short i = 0; i < numPartitions; i++) {
      partitions.add(i);
    }
    return partitions;
  }
961095
public void addNode(String name, Set<ResourceType> resourceTypes) {
    List<FaultStatsForType> faultStats = new ArrayList<FaultStatsForType>(
        resourceTypes.size());
    for (ResourceType type : resourceTypes) {
      faultStats.add(new FaultStatsForType(type));
    }
    nodeToFaultStats.put(name, faultStats);
  }
297423
def assign_to_topic_partition(self, topic_partition=None):
        

        if isinstance(topic_partition, TopicPartition):
            topic_partition = [topic_partition]
        if not self._is_assigned(topic_partition):
            self.consumer.assign(topic_partition)
20694
def partitions_for_topic(self, topic):
        
        if topic not in self._partitions:
            return None
        return set(self._partitions[topic].keys())
1034530
public int getPartition(K key, V value, 
                          int numPartitions) {
    Integer result = cache.get();
    if (result == null) {
      return part.getPartition(key, value, numPartitions);
    } else {
      return result;
    }
  }
152137
public void setPartitionValues(java.util.Collection<String> partitionValues) {
        if (partitionValues == null) {
            this.partitionValues = null;
            return;
        }

        this.partitionValues = new java.util.ArrayList<String>(partitionValues);
    }
617512
@Override
  public Streamlet<R> repartition(int numPartitions,
                           SerializableBiFunction<R, Integer, List<Integer>> partitionFn) {
    checkNotNull(partitionFn, "partitionFn cannot be null");

    RemapStreamlet<R> retval = new RemapStreamlet<>(this, partitionFn);
    retval.setNumPartitions(numPartitions);
    addChild(retval);
    return retval;
  }
1202290
def publish(topic_name: nil, event_name: nil, schema_name: nil, primary_key: nil, body:)
      defaults = self.class.get_publish_defaults
      published_messages << Maitredee.publish(
        topic_name: topic_name || defaults[:topic_name],
        event_name: event_name || defaults[:event_name],
        schema_name: schema_name || defaults[:schema_name],
        primary_key: primary_key,
        body: body
      )
    end
1202747
public static Map<String, List<String>> getPartitionsForTopics(ZkClient zkClient, Collection<String> topics) {
        Map<String, List<String>> ret = new HashMap<String, List<String>>();
        for (String topic : topics) {
            List<String> partList = new ArrayList<String>();
            List<String> brokers = getChildrenParentMayNotExist(zkClient, BrokerTopicsPath + "/" + topic);
            if (brokers != null) {
                for (String broker : brokers) {
                    final String parts = readData(zkClient, BrokerTopicsPath + "/" + topic + "/" + broker);
                    int nParts = Integer.parseInt(parts);
                    for (int i = 0; i < nParts; i++) {
                        partList.add(broker + "-" + i);
                    }
                }
            }
            Collections.sort(partList);
            ret.put(topic, partList);
        }
        return ret;
    }
1307898
def npartitions(self):
        
        if self.mode == 'spark':
            return self.tordd().getNumPartitions()
        else:
            notsupported(self.mode)
1216501
def add_topic(self, topic):
        
        if topic in self._topics:
            return Future().success(set(self._topics))

        self._topics.add(topic)
        return self.cluster.request_update()
752244
def partitionBy(self, numPartitions, partitionFunc=portable_hash):
        
        return self.transform(lambda rdd: rdd.partitionBy(numPartitions, partitionFunc))
1202642
def repartition(self, npartitions):
        
        if self.mode == 'spark':
            return self._constructor(self.values.repartition(npartitions)).__finalize__(self)
        else:
            notsupported(self.mode)
374618
public TopicDefinition createTopicDefinition( String topicName , boolean temporary )
    {
        TopicDefinition def = new TopicDefinition();
        def.setName(topicName);
        def.setTemporary(temporary);
        copyAttributesTo(def);
        def.setSubscriberFailurePolicy(subscriberFailurePolicy);
        def.setSubscriberOverflowPolicy(subscriberOverflowPolicy);
        def.setPartitionsKeysToIndex(partitionsKeysToIndex);
        
        return def;
    }