gpt4 book ai didi

io.druid.indexing.overlord.ZkWorker.getRunningTasks()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:53:19 27 4
gpt4 key购买 nike

本文整理了Java中io.druid.indexing.overlord.ZkWorker.getRunningTasks()方法的一些代码示例,展示了ZkWorker.getRunningTasks()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkWorker.getRunningTasks()方法的具体详情如下:
包路径:io.druid.indexing.overlord.ZkWorker
类名称:ZkWorker
方法名:getRunningTasks

ZkWorker.getRunningTasks介绍

暂无

代码示例

代码示例来源:origin: com.n3twork.druid/druid-indexing-service

public boolean isRunningTask(String taskId)
{
 return getRunningTasks().containsKey(taskId);
}

代码示例来源:origin: io.druid/druid-indexing-service

public boolean isRunningTask(String taskId)
{
 return getRunningTasks().containsKey(taskId);
}

代码示例来源:origin: io.druid/druid-indexing-service

@JsonProperty("runningTasks")
public Collection<String> getRunningTaskIds()
{
 return getRunningTasks().keySet();
}

代码示例来源:origin: com.n3twork.druid/druid-indexing-service

@JsonProperty("runningTasks")
public Collection<String> getRunningTaskIds()
{
 return getRunningTasks().keySet();
}

代码示例来源:origin: io.druid/druid-indexing-service

@JsonProperty("availabilityGroups")
public Set<String> getAvailabilityGroups()
{
 Set<String> retVal = Sets.newHashSet();
 for (TaskAnnouncement taskAnnouncement : getRunningTasks().values()) {
  retVal.add(taskAnnouncement.getTaskResource().getAvailabilityGroup());
 }
 return retVal;
}

代码示例来源:origin: com.n3twork.druid/druid-indexing-service

@JsonProperty("availabilityGroups")
public Set<String> getAvailabilityGroups()
{
 Set<String> retVal = Sets.newHashSet();
 for (TaskAnnouncement taskAnnouncement : getRunningTasks().values()) {
  retVal.add(taskAnnouncement.getTaskResource().getAvailabilityGroup());
 }
 return retVal;
}

代码示例来源:origin: com.n3twork.druid/druid-indexing-service

@JsonProperty("currCapacityUsed")
public int getCurrCapacityUsed()
{
 int currCapacity = 0;
 for (TaskAnnouncement taskAnnouncement : getRunningTasks().values()) {
  currCapacity += taskAnnouncement.getTaskResource().getRequiredCapacity();
 }
 return currCapacity;
}

代码示例来源:origin: io.druid/druid-indexing-service

@JsonProperty("currCapacityUsed")
public int getCurrCapacityUsed()
{
 int currCapacity = 0;
 for (TaskAnnouncement taskAnnouncement : getRunningTasks().values()) {
  currCapacity += taskAnnouncement.getTaskResource().getRequiredCapacity();
 }
 return currCapacity;
}

代码示例来源:origin: com.n3twork.druid/druid-indexing-service

@Override
 public boolean apply(ZkWorker worker)
 {
  final boolean itHasBeenAWhile = System.currentTimeMillis() - worker.getLastCompletedTaskTime().getMillis()
                  >= config.getWorkerIdleTimeout().toStandardDuration().getMillis();
  return worker.getRunningTasks().isEmpty() && (itHasBeenAWhile || !isValidWorker.apply(worker));
 }
};

代码示例来源:origin: io.druid/druid-indexing-service

/**
 * A task will be run only if there is no current knowledge in the RemoteTaskRunner of the task.
 *
 * @param task task to run
 */
@Override
public ListenableFuture<TaskStatus> run(final Task task)
{
 final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask;
 if ((pendingTask = pendingTasks.get(task.getId())) != null) {
  log.info("Assigned a task[%s] that is already pending, not doing anything", task.getId());
  return pendingTask.getResult();
 } else if ((runningTask = runningTasks.get(task.getId())) != null) {
  ZkWorker zkWorker = findWorkerRunningTask(task.getId());
  if (zkWorker == null) {
   log.warn("Told to run task[%s], but no worker has started running it yet.", task.getId());
  } else {
   log.info("Task[%s] already running on %s.", task.getId(), zkWorker.getWorker().getHost());
   TaskAnnouncement announcement = zkWorker.getRunningTasks().get(task.getId());
   if (announcement.getTaskStatus().isComplete()) {
    taskComplete(runningTask, zkWorker, announcement.getTaskStatus());
   }
  }
  return runningTask.getResult();
 } else if ((completeTask = completeTasks.get(task.getId())) != null) {
  return completeTask.getResult();
 } else {
  return addPendingTask(task).getResult();
 }
}

代码示例来源:origin: com.n3twork.druid/druid-indexing-service

/**
 * A task will be run only if there is no current knowledge in the RemoteTaskRunner of the task.
 *
 * @param task task to run
 */
@Override
public ListenableFuture<TaskStatus> run(final Task task)
{
 final RemoteTaskRunnerWorkItem completeTask, runningTask, pendingTask;
 if ((pendingTask = pendingTasks.get(task.getId())) != null) {
  log.info("Assigned a task[%s] that is already pending, not doing anything", task.getId());
  return pendingTask.getResult();
 } else if ((runningTask = runningTasks.get(task.getId())) != null) {
  ZkWorker zkWorker = findWorkerRunningTask(task.getId());
  if (zkWorker == null) {
   log.warn("Told to run task[%s], but no worker has started running it yet.", task.getId());
  } else {
   log.info("Task[%s] already running on %s.", task.getId(), zkWorker.getWorker().getHost());
   TaskAnnouncement announcement = zkWorker.getRunningTasks().get(task.getId());
   if (announcement.getTaskStatus().isComplete()) {
    taskComplete(runningTask, zkWorker, announcement.getTaskStatus());
   }
  }
  return runningTask.getResult();
 } else if ((completeTask = completeTasks.get(task.getId())) != null) {
  return completeTask.getResult();
 } else {
  return addPendingTask(task).getResult();
 }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com