Package org.apache.flink.api.common
Class TaskInfo
- java.lang.Object
-
- org.apache.flink.api.common.TaskInfo
-
@Internal public class TaskInfo extends Object
Encapsulates task-specific information: name, index of subtask, parallelism and attempt number.
-
-
Constructor Summary
Constructors Constructor Description TaskInfo(String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber)TaskInfo(String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber, String allocationIDAsString)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAllocationIDAsString()Returns the allocation id for where this task is executed.intgetAttemptNumber()Gets the attempt number of this parallel subtask.intgetIndexOfThisSubtask()Gets the number of this parallel subtask.intgetMaxNumberOfParallelSubtasks()Gets the max parallelism aka the max number of subtasks.intgetNumberOfParallelSubtasks()Gets the parallelism with which the parallel task runs.StringgetTaskName()Returns the name of the taskStringgetTaskNameWithSubtasks()Returns the name of the task, appended with the subtask indicator, such as "MyTask (3/6)#1", where 3 would be (getIndexOfThisSubtask()+ 1), and 6 would begetNumberOfParallelSubtasks(), and 1 would begetAttemptNumber().
-
-
-
Constructor Detail
-
TaskInfo
public TaskInfo(String taskName, int maxNumberOfParallelSubtasks, int indexOfSubtask, int numberOfParallelSubtasks, int attemptNumber)
-
-
Method Detail
-
getTaskName
public String getTaskName()
Returns the name of the task- Returns:
- The name of the task
-
getMaxNumberOfParallelSubtasks
public int getMaxNumberOfParallelSubtasks()
Gets the max parallelism aka the max number of subtasks.
-
getIndexOfThisSubtask
public int getIndexOfThisSubtask()
Gets the number of this parallel subtask. The numbering starts from 0 and goes up to parallelism-1 (parallelism as returned bygetNumberOfParallelSubtasks()).- Returns:
- The index of the parallel subtask.
-
getNumberOfParallelSubtasks
public int getNumberOfParallelSubtasks()
Gets the parallelism with which the parallel task runs.- Returns:
- The parallelism with which the parallel task runs.
-
getAttemptNumber
public int getAttemptNumber()
Gets the attempt number of this parallel subtask. First attempt is numbered 0. The attempt number corresponds to the number of times this task has been restarted(after failure/cancellation) since the job was initially started.- Returns:
- Attempt number of the subtask.
-
getTaskNameWithSubtasks
public String getTaskNameWithSubtasks()
Returns the name of the task, appended with the subtask indicator, such as "MyTask (3/6)#1", where 3 would be (getIndexOfThisSubtask()+ 1), and 6 would begetNumberOfParallelSubtasks(), and 1 would begetAttemptNumber().- Returns:
- The name of the task, with subtask indicator.
-
getAllocationIDAsString
public String getAllocationIDAsString()
Returns the allocation id for where this task is executed.- Returns:
- the allocation id for where this task is executed.
-
-