项目:denovo-variant-caller-java
文件:VariantsBuffer.java
/** Get Matching variant from the queue
* @param person trio member
* @param snpPosition
* @return Get matching variant call pairs at matching position
*/
private Pair<Variant,VariantCall> getMatchingPair(TrioMember person,Long snpPosition) {
for (Pair<Variant,VariantCall> pair : getQueue(person)) {
Variant variant = pair.getValue0();
if (Ranges.closedOpen(variant.getStart(),variant.getEnd()).contains(snpPosition)) {
return pair;
}
}
return null;
}
/**
* Helper method to restart instances of runnables.
*/
private void restartRunnableInstances(final String runnableName,@Nullable final Set<Integer> instanceIds,final Runnable completion) {
instanceChangeExecutor.execute(new Runnable() {
@Override
public void run() {
LOG.debug("Begin restart runnable {} instances.",runnableName);
int runningCount = runningContainers.count(runnableName);
Set<Integer> instancesToRemove = instanceIds == null ? null : ImmutableSet.copyOf(instanceIds);
if (instancesToRemove == null) {
instancesToRemove = Ranges.closedOpen(0,runningCount).asSet(discreteDomains.integers());
}
LOG.info("Restarting instances {} for runnable {}",instancesToRemove,runnableName);
RunnableContainerRequest containerRequest =
createRunnableContainerRequest(runnableName,instancesToRemove.size(),false);
runnableContainerRequests.add(containerRequest);
for (int instanceId : instancesToRemove) {
LOG.debug("Stop instance {} for runnable {}",instanceId,runnableName);
try {
runningContainers.stopByIdAndWait(runnableName,instanceId);
} catch (Exception ex) {
// Could be thrown if the container already stopped.
LOG.info("Exception thrown when stopping instance {} probably already stopped.",instanceId);
}
}
LOG.info("All instances in {} for runnable {} are stopped. Ready to provision",runnableName);
// set the container request to be ready
containerRequest.setReadyToBeProvisioned();
// For all runnables that needs to re-request for containers,update the expected count timestamp
// so that the EventHandler would be triggered with the right expiration timestamp.
expectedContainers.updateRequestTime(Collections.singleton(runnableName));
completion.run();
}
});
}
项目:envelope
文件:LoopStep.java
项目:hadoop-2.6.0-cdh5.4.3
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
Preconditions.checkArgument(seg.hasEndTxId(),"invalid segment: %s",seg);
return Ranges.closed(seg.getStartTxId(),seg.getEndTxId());
}
项目:hadoop-EAR
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
return Ranges.closed(seg.getStartTxId(),seg.getEndTxId());
}
项目:hadoop-plus
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
Preconditions.checkArgument(seg.hasEndTxId(),seg.getEndTxId());
}
项目:FlexMap
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
Preconditions.checkArgument(seg.hasEndTxId(),seg.getEndTxId());
}
项目:hadoop-TCP
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
Preconditions.checkArgument(seg.hasEndTxId(),seg.getEndTxId());
}
项目:hardfs
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
Preconditions.checkArgument(seg.hasEndTxId(),seg.getEndTxId());
}
项目:hadoop-on-lustre2
文件:Journal.java
private Range<Long> txnRange(SegmentStateProto seg) {
Preconditions.checkArgument(seg.hasEndTxId(),seg.getEndTxId());
}
项目:cdk-examples
文件:GenerateSimpleLogs.java
@Override
public int run(String[] args) throws Exception {
// going to generate a lot of random log messages
final Random rand = new Random();
// open the repository
final DatasetRepository repo = DatasetRepositories.open("repo:file:/tmp/data");
// data is written to the staging dataset
final Dataset<GenericRecord> staging = repo.load("logs-staging");
final DatasetWriter<GenericRecord> writer = staging.newWriter();
// this is going to build our simple log records
final GenericRecordBuilder builder = new GenericRecordBuilder(
staging.getDescriptor().getSchema());
// generate timestamps 1 second apart starting... Now
final Calendar Now = Calendar.getInstance();
final long yesterday = Now.getTimeInMillis() - DAY_IN_MILLIS;
try {
writer.open();
// generate 15,000 messages,each 5 seconds apart,starting 24 hours ago
// this is a little less than 24 hours worth of messages
for (int second : Ranges.closed(0,15000).asSet(discreteDomains.integers())) {
LOG.info("Generating log message " + second);
builder.set("timestamp",yesterday + second * 5000);
builder.set("component","GenerateSimpleLogs");
int level = rand.nextInt(LOG_LEVELS.length);
builder.set("level",LOG_LEVELS[level]);
builder.set("message",LOG_MESSAGES[level]);
writer.write(builder.build());
}
} finally {
writer.flush();
writer.close();
}
return 0;
}
项目:kite-examples
文件:GenerateSimpleLogs.java
@Override
public int run(String[] args) throws Exception {
// going to generate a lot of random log messages
final Random rand = new Random();
// data is written to the staging dataset
Dataset<Record> staging = Datasets.load(
"dataset:file:/tmp/data/logs_staging",Record.class);
// this is going to build our simple log records
GenericRecordBuilder builder = new GenericRecordBuilder(
staging.getDescriptor().getSchema());
// generate timestamps 1 second apart starting 1 day ago
final Calendar Now = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
final long yesterday = Now.getTimeInMillis() - DAY_IN_MILLIS;
DatasetWriter<Record> writer = null;
try {
writer = staging.newWriter();
// generate 15,LOG_MESSAGES[level]);
writer.write(builder.build());
}
if (writer instanceof Flushable) {
((Flushable) writer).flush();
}
} finally {
if (writer != null) {
writer.close();
}
}
return 0;
}
项目:incubator-provisionr
文件:RuleBuilder.java
public RuleBuilder ports(int lowerPort,int upperPort) {
return ports(Ranges.closed(lowerPort,upperPort));
}
项目:kangaroo
文件:ZkUtils.java
/**
* Checks whether the provided partition exists on the {@link broker}.
*
* @param broker
* the broker.
* @param topic
* the topic.
* @param partId
* the partition id.
* @return true if this partition exists on the {@link broker},false otherwise.
*/
public boolean partitionExists(final broker broker,final String topic,final int partId) {
final String parts = client.readData(getTopicbrokerIdpath(topic,broker.getId()),true);
return !Strings.isNullOrEmpty(parts) && Ranges.closedOpen(0,Integer.parseInt(parts)).contains(partId);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。