public interface TaskContext
TaskContext
is passed to the task instances when they are being prepared to
execute. This class is used for getting information about the task as well as sending messages.Modifier and Type | Method and Description |
---|---|
void |
end(java.lang.String edge)
End the current writing
|
void |
endAll()
Ends all the 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 in edges of the task.
|
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
|
default java.util.Set<TaskInstancePlan> |
getTasksByName(java.lang.String name)
Instances of tasks for the given name
|
default java.util.Set<TaskInstancePlan> |
getTasksInThisWorkerByName(java.lang.String name)
Tasks of given type which have been scheduled in this worker
|
default WorkerSchedulePlan |
getWorker()
Get the container of this 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()
Task id
|
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
|
void reset()
int taskIndex()
int globalTaskId()
int taskId()
java.lang.String taskName()
int getParallelism()
int getWorkerId()
java.util.Map<java.lang.String,java.lang.Object> getConfigurations()
java.lang.Object getConfig(java.lang.String name)
name
- name of the configjava.util.Map<java.lang.String,java.lang.String> getOutEdges()
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getInEdges()
boolean write(java.lang.String edge, java.lang.Object key, java.lang.Object message)
edge
- the edgekey
- keymessage
- messageboolean write(java.lang.String edge, java.lang.Object message)
edge
- edgemessage
- messageboolean writeBarrier(java.lang.String edge, java.lang.Object message)
edge
- edgemessage
- messageboolean writeEnd(java.lang.String edge, java.lang.Object message)
edge
- edgemessage
- messageboolean writeEnd(java.lang.String edge, java.lang.Object key, java.lang.Object message)
edge
- edgekey
- keymessage
- messagevoid end(java.lang.String edge)
edge
- edgevoid endAll()
boolean isDone(java.lang.String edge)
edge
- edge namejava.util.Set<WorkerSchedulePlan> getWorkers()
java.util.Map<java.lang.Integer,WorkerSchedulePlan> getWorkersMap()
default WorkerSchedulePlan getWorker()
default java.util.Set<TaskInstancePlan> getTasksByName(java.lang.String name)
default java.util.Set<TaskInstancePlan> getTasksInThisWorkerByName(java.lang.String name)
OperationMode getOperationMode()