public class TaskContextImpl extends java.lang.Object implements TaskContext
Constructor and Description |
---|
TaskContextImpl(int taskIndex,
int taskId,
int globalTaskId,
java.lang.String taskName,
int parallelism,
int wId,
java.util.Map<java.lang.String,java.lang.Object> configs,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> inputs,
TaskSchedulePlan taskSchedulePlan,
OperationMode opMode) |
TaskContextImpl(int taskIndex,
int taskId,
int globalTaskId,
java.lang.String taskName,
int parallelism,
int wId,
OutputCollection collection,
java.util.Map<java.lang.String,java.lang.Object> configs,
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> inputs,
java.util.Map<java.lang.String,java.lang.String> outEdges,
TaskSchedulePlan taskSchedulePlan,
OperationMode opMode) |
TaskContextImpl(int taskIndex,
int taskId,
int globalTaskId,
java.lang.String taskName,
int parallelism,
int wId,
OutputCollection collection,
java.util.Map<java.lang.String,java.lang.Object> configs,
java.util.Map<java.lang.String,java.lang.String> outEdges,
TaskSchedulePlan taskSchedulePlan,
OperationMode opMode) |
Modifier and Type | Method and Description |
---|---|
void |
end(java.lang.String edge)
End the current writing
|
void |
endAll()
Ends all edges
|
java.lang.Object |
getConfig(java.lang.String name)
Get a configuration with a name
|
java.util.Map<java.lang.String,java.lang.Object> |
getConfigurations()
Get the task specific configurations
|
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getInEdges()
Get the edge names and the tasks connected using those edges
|
OperationMode |
getOperationMode()
Get the operation mode of the task graph
|
java.util.Map<java.lang.String,java.lang.String> |
getOutEdges()
Get the out edges of this task
|
int |
getParallelism()
Get the parallism of the task
|
int |
getWorkerId()
Get the worker id this task is running
|
java.util.Set<WorkerSchedulePlan> |
getWorkers()
Set of workers in the current topology
|
java.util.Map<java.lang.Integer,WorkerSchedulePlan> |
getWorkersMap()
Map of worker where value is the container id
|
int |
globalTaskId()
Globally unique id
|
boolean |
isCompleted()
Weather all the edges are finished (whether the task is completed)
|
boolean |
isDone(java.lang.String edge)
Return true, if this task is done
|
void |
reset()
Reset the context
|
int |
taskId()
Get the task id for this task
|
int |
taskIndex()
The task index
|
java.lang.String |
taskName()
Name of the task
|
boolean |
write(java.lang.String edge,
java.lang.Object message)
Write a message to the destination
|
boolean |
write(java.lang.String edge,
java.lang.Object key,
java.lang.Object message)
Write a message with a key
|
boolean |
writeBarrier(java.lang.String edge,
java.lang.Object message)
Write a barrier message to the destination
|
boolean |
writeEnd(java.lang.String edge,
java.lang.Object message)
Write the last message
|
boolean |
writeEnd(java.lang.String edge,
java.lang.Object key,
java.lang.Object message)
Write the last message
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTasksByName, getTasksInThisWorkerByName, getWorker
public TaskContextImpl(int taskIndex, int taskId, int globalTaskId, java.lang.String taskName, int parallelism, int wId, java.util.Map<java.lang.String,java.lang.Object> configs, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> inputs, TaskSchedulePlan taskSchedulePlan, OperationMode opMode)
public TaskContextImpl(int taskIndex, int taskId, int globalTaskId, java.lang.String taskName, int parallelism, int wId, OutputCollection collection, java.util.Map<java.lang.String,java.lang.Object> configs, java.util.Map<java.lang.String,java.lang.String> outEdges, TaskSchedulePlan taskSchedulePlan, OperationMode opMode)
public TaskContextImpl(int taskIndex, int taskId, int globalTaskId, java.lang.String taskName, int parallelism, int wId, OutputCollection collection, java.util.Map<java.lang.String,java.lang.Object> configs, java.util.Map<java.lang.String,java.util.Set<java.lang.String>> inputs, java.util.Map<java.lang.String,java.lang.String> outEdges, TaskSchedulePlan taskSchedulePlan, OperationMode opMode)
public java.util.Set<WorkerSchedulePlan> getWorkers()
TaskContext
getWorkers
in interface TaskContext
public java.util.Map<java.lang.Integer,WorkerSchedulePlan> getWorkersMap()
TaskContext
getWorkersMap
in interface TaskContext
public OperationMode getOperationMode()
TaskContext
getOperationMode
in interface TaskContext
public void reset()
reset
in interface TaskContext
public int taskIndex()
taskIndex
in interface TaskContext
public int globalTaskId()
globalTaskId
in interface TaskContext
public int taskId()
taskId
in interface TaskContext
public java.lang.String taskName()
taskName
in interface TaskContext
public int getParallelism()
getParallelism
in interface TaskContext
public int getWorkerId()
getWorkerId
in interface TaskContext
public java.util.Map<java.lang.String,java.lang.Object> getConfigurations()
getConfigurations
in interface TaskContext
public java.lang.Object getConfig(java.lang.String name)
getConfig
in interface TaskContext
name
- name of the configpublic java.util.Map<java.lang.String,java.lang.String> getOutEdges()
getOutEdges
in interface TaskContext
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getInEdges()
getInEdges
in interface TaskContext
public boolean write(java.lang.String edge, java.lang.Object key, java.lang.Object message)
write
in interface TaskContext
edge
- the edgekey
- keymessage
- messagepublic boolean write(java.lang.String edge, java.lang.Object message)
write
in interface TaskContext
edge
- edgemessage
- messagepublic boolean writeBarrier(java.lang.String edge, java.lang.Object message)
TaskContext
writeBarrier
in interface TaskContext
edge
- edgemessage
- messagepublic boolean writeEnd(java.lang.String edge, java.lang.Object message)
writeEnd
in interface TaskContext
edge
- edgemessage
- messagepublic boolean writeEnd(java.lang.String edge, java.lang.Object key, java.lang.Object message)
writeEnd
in interface TaskContext
edge
- edgekey
- keymessage
- messagepublic void end(java.lang.String edge)
end
in interface TaskContext
edge
- edgepublic void endAll()
endAll
in interface TaskContext
public boolean isDone(java.lang.String edge)
isDone
in interface TaskContext
edge
- edge namepublic boolean isCompleted()