Examples of offsets()


Examples of ise.mace.neuralnetworks.NetworkGenome.offsets()

    super(genome.initialFood(), genome.consumption(),
        genome.type(), genome.socialBelief(), genome.economicBelief());

    NetworkGenome cfGenome = genome.chooseFoodGenome();
    chooseFoodNet = new TanhFeedForwardNetwork(cfGenome.nodeCounts());
    chooseFoodNet.setOffsets(cfGenome.offsets());
    chooseFoodNet.setWeights(cfGenome.weights());
  }

  @Override
  protected Food chooseFood()
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

                    System.out
                            .println("Error fetching data Offset Data the Broker. Reason: "
                                    + response.errorCode(topic, i));
                    return null;
                }
                long[] offsets = response.offsets(topic, i);
                System.out.println("Topic: " + topic + " partition: " + i
                        + " offset: " + offsets[0]);
                lastOffsets.put(new TopicPartition(topic, i), offsets[0]);
            }
        }
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

        if (response.hasError()) {
            throw new RuntimeException("Error fetching offset data. Reason: " +
                    response.errorCode(topicPartition.getTopic(), topicPartition.getPartition()));
        }
        long[] offsets = response.offsets(topicPartition.getTopic(),
                topicPartition.getPartition());
        return offsets[0] - 1;
    }

    private Message getMessage(TopicPartition topicPartition, long offset,
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

            short errorCode = offsetResponse.errorCode(partition.getTopicName(), partition.getPartitionIdAsInt());
            log.warn("Offset response has error: %d", errorCode);
            throw new PrestoException(KafkaErrorCode.KAFKA_SPLIT_ERROR.toErrorCode(), "could not fetch data from Kafka, error code is '" + errorCode + "'");
        }

        return offsetResponse.offsets(partition.getTopicName(), partition.getPartitionIdAsInt());
    }

    private static Function<Broker, HostAddress> brokerToHostAddress()
    {
        return new Function<Broker, HostAddress>()
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

    ), kafka.api.OffsetRequest.CurrentVersion(), consumer.clientId());

    OffsetResponse response = consumer.getOffsetsBefore(request);

    // Retrieve offsets from response
    long[] offsets = response.hasError() ? null : response.offsets(topicPart.getTopic(), topicPart.getPartition());
    if (offsets == null || offsets.length <= 0) {
      short errorCode = response.errorCode(topicPart.getTopic(), topicPart.getPartition());

      // If the topic partition doesn't exists, use offset 0 without logging error.
      if (errorCode != ErrorMapping.UnknownTopicOrPartitionCode()) {
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

            offsetInfo.put(new TopicAndPartition(topic, partition), new PartitionOffsetRequestInfo(
                    kafka.api.OffsetRequest.EarliestTime(), 1));
            OffsetResponse response = consumer
                    .getOffsetsBefore(new OffsetRequest(offsetInfo, kafka.api.OffsetRequest
                            .CurrentVersion(), "hadoop-etl"));
            long[] endOffset = response.offsets(topic, partition);
            consumer.close();
            this.earliestOffset = endOffset[0];
            return endOffset[0];
        } else {
            return this.earliestOffset;
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

        Map<TopicAndPartition, PartitionOffsetRequestInfo> offsetInfo = new HashMap<TopicAndPartition, PartitionOffsetRequestInfo>();
        offsetInfo.put(new TopicAndPartition(topic, partition), new PartitionOffsetRequestInfo(
                time, 1));
        OffsetResponse response = consumer.getOffsetsBefore(new OffsetRequest(offsetInfo,
                kafka.api.OffsetRequest.CurrentVersion(),"hadoop-etl"));
        long[] endOffset = response.offsets(topic, partition);
        consumer.close();
        if(endOffset.length == 0)
        {
          log.info("The exception is thrown because the latest offset retunred zero for topic : " + topic + " and partition " + partition);
        }
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

      consumer.close();
      for (TopicAndPartition topicAndPartition : topicAndPartitions) {
        long latestOffset = latestOffsetResponse.offsets(
            topicAndPartition.topic(),
            topicAndPartition.partition())[0];
        long earliestOffset = earliestOffsetResponse.offsets(
            topicAndPartition.topic(),
            topicAndPartition.partition())[0];
       
        //TODO: factor out kafka specific request functionality
        CamusRequest etlRequest = new EtlRequest(context,
View Full Code Here

Examples of kafka.javaapi.OffsetResponse.offsets()

          consumer.host(), consumer.port(), topic, partition, response.errorCode(topic, partition));
        LOG.error(message);
        throw new RuntimeException(message);
      }
    }
    long[] offsets = response.offsets(topic, partition);
    if (offsets.length == 0) {
      closeConsumer();
      String message =
        String.format("Got zero offsets in offset response for time %s from broker %s:%d for topic %s, partiton %d",
                      offset, consumer.host(), consumer.port(), topic, partition);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.