public class RemoteTaskRunner extends Object implements TaskRunner, io.druid.tasklogs.TaskLogStreamer
ResourceManagementScheduler
can take care of these duties.
If a worker node becomes inexplicably disconnected from Zk, the RemoteTaskRunner will fail any tasks associated with the
worker after waiting for RemoteTaskRunnerConfig.taskCleanupTimeout for the worker to show up.
The RemoteTaskRunner uses ZK for job management and assignment and http for IPC messages.Constructor and Description |
---|
RemoteTaskRunner(com.fasterxml.jackson.databind.ObjectMapper jsonMapper,
RemoteTaskRunnerConfig config,
IndexerZkConfig indexerZkConfig,
org.apache.curator.framework.CuratorFramework cf,
PathChildrenCacheFactory pathChildrenCacheFactory,
com.metamx.http.client.HttpClient httpClient,
com.google.common.base.Supplier<WorkerBehaviorConfig> workerConfigRef,
ScheduledExecutorService cleanupExec) |
Modifier and Type | Method and Description |
---|---|
ZkWorker |
findWorkerRunningTask(String taskId) |
Collection<RemoteTaskRunnerWorkItem> |
getKnownTasks() |
List<ZkWorker> |
getLazyWorkers() |
Collection<RemoteTaskRunnerWorkItem> |
getPendingTasks() |
Collection<RemoteTaskRunnerWorkItem> |
getRunningTasks() |
Collection<ZkWorker> |
getWorkers() |
boolean |
isWorkerRunningTask(Worker worker,
String taskId) |
List<ZkWorker> |
markWorkersLazy(com.google.common.base.Predicate<ZkWorker> isLazyWorker,
int maxWorkers) |
com.google.common.util.concurrent.ListenableFuture<TaskStatus> |
run(Task task)
A task will be run only if there is no current knowledge in the RemoteTaskRunner of the task.
|
void |
shutdown(String taskId)
Finds the worker running the task and forwards the shutdown signal to the worker.
|
void |
start() |
void |
stop() |
com.google.common.base.Optional<com.google.common.io.ByteSource> |
streamTaskLog(String taskId,
long offset) |
public RemoteTaskRunner(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, RemoteTaskRunnerConfig config, IndexerZkConfig indexerZkConfig, org.apache.curator.framework.CuratorFramework cf, PathChildrenCacheFactory pathChildrenCacheFactory, com.metamx.http.client.HttpClient httpClient, com.google.common.base.Supplier<WorkerBehaviorConfig> workerConfigRef, ScheduledExecutorService cleanupExec)
public void start()
public void stop()
public Collection<ZkWorker> getWorkers()
getWorkers
in interface TaskRunner
public Collection<RemoteTaskRunnerWorkItem> getRunningTasks()
getRunningTasks
in interface TaskRunner
public Collection<RemoteTaskRunnerWorkItem> getPendingTasks()
getPendingTasks
in interface TaskRunner
public Collection<RemoteTaskRunnerWorkItem> getKnownTasks()
getKnownTasks
in interface TaskRunner
public com.google.common.util.concurrent.ListenableFuture<TaskStatus> run(Task task)
run
in interface TaskRunner
task
- task to runpublic void shutdown(String taskId)
shutdown
in interface TaskRunner
taskId
- - task id to shutdownpublic com.google.common.base.Optional<com.google.common.io.ByteSource> streamTaskLog(String taskId, long offset)
streamTaskLog
in interface io.druid.tasklogs.TaskLogStreamer
public List<ZkWorker> markWorkersLazy(com.google.common.base.Predicate<ZkWorker> isLazyWorker, int maxWorkers)
Copyright © 2011–2015. All rights reserved.