zhijiangW commented on a change in pull request #8529: [FLINK-12603][network]
Remove getOwningTaskName method from InputGate
URL: https://github.com/apache/flink/pull/8529#discussion_r289873626
##########
File path: flink-core/src/main/java/org/apache/flink/api/common/TaskInfo.java
##########
@@ -132,11 +122,67 @@ public String getTaskNameWithSubtasks() {
return this.taskNameWithSubtasks;
}
+ /**
+ * Returns the name of the task, appended with the subtask indicator
and execution attempt id.
+ *
+ * @return The name of the task, with subtask indicator and execution
id.
+ */
+ public String getTaskNameWithSubtaskAndID() {
+ return taskNameWithSubtaskAndID;
+ }
+
/**
* Returns the allocation id for where this task is executed.
* @return the allocation id for where this task is executed.
*/
public String getAllocationIDAsString() {
return allocationIDAsString;
}
+
+ //
------------------------------------------------------------------------
+ // Factory Utilities
+ //
------------------------------------------------------------------------
+
+ public static TaskInfo create(
+ String taskName,
+ int maxNumberOfParallelSubtasks,
+ int numberOfParallelSubtasks,
+ int subtaskIndex,
+ int attemptNumber,
+ String attemptIDAsString,
+ String allocationIDAsString) {
+
+ String taskNameWithSubtask = taskName + " (" + (subtaskIndex +
1) + '/' + numberOfParallelSubtasks + ')';
+ String taskNameWithSubtaskAndId = taskNameWithSubtask + " (" +
attemptIDAsString + ')';
+
+ return new TaskInfo(
+ taskName,
+ taskNameWithSubtask,
+ taskNameWithSubtaskAndId,
+ maxNumberOfParallelSubtasks,
+ subtaskIndex,
+ numberOfParallelSubtasks,
+ attemptNumber,
+ allocationIDAsString);
+ }
+
+ @VisibleForTesting
+ public static TaskInfo create(
+ String taskName,
+ int maxNumberOfParallelSubtasks,
+ int subtaskIndex,
+ int numberOfParallelSubtasks,
+ int attemptNumber) {
+
+ String taskNameWithSubtask = taskName + " (" + (subtaskIndex +
1) + '/' + numberOfParallelSubtasks + ')';
+ return new TaskInfo(
+ taskName,
+ taskNameWithSubtask,
+ taskNameWithSubtask,
Review comment:
Agree, then we could also avoid test related codes here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services