zhijiangW commented on a change in pull request #7822: [FLINK-11726][network] Refactor the
creation of ResultPartition and InputGate into NetworkEnvironment
URL: https://github.com/apache/flink/pull/7822#discussion_r278913036
##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
##########
@@ -367,50 +366,47 @@ public Task(
final String taskNameWithSubtaskAndId = taskNameWithSubtask + " (" + executionId + ')';
- // Produced intermediate result partitions
- this.producedPartitions = new ResultPartition[resultPartitionDeploymentDescriptors.size()];
+ // add metrics for buffers
+ final MetricGroup buffersGroup = metrics.getIOMetricGroup().addGroup("buffers");
- int counter = 0;
+ final Optional<MetricGroup> outputGroup, inputGroup;
- for (ResultPartitionDeploymentDescriptor desc: resultPartitionDeploymentDescriptors) {
- ResultPartitionID partitionId = new ResultPartitionID(desc.getPartitionId(), executionId);
-
- this.producedPartitions[counter] = new ResultPartition(
- taskNameWithSubtaskAndId,
- this,
- jobId,
- partitionId,
- desc.getPartitionType(),
- desc.getNumberOfSubpartitions(),
- desc.getMaxParallelism(),
- networkEnvironment.getResultPartitionManager(),
- resultPartitionConsumableNotifier,
- ioManager,
- desc.sendScheduleOrUpdateConsumersMessage());
-
- ++counter;
+ // register detailed network metrics, if configured
+ if (taskManagerConfig.getConfiguration().getBoolean(TaskManagerOptions.NETWORK_DETAILED_METRICS))
{
Review comment:
There are two reasons for using `Optional` here:
1. If we pass `Input/OutputGroup` directly, `NETWORK_DETAILED_METRICS` would be checked
twice in both `Task` and `NetworkEnvironmentConfiguration`.
2. The `Input/OutputGroup` might be nullable. IMO the optional parameters in interface
method might seem better than `Nullable`, also comparing `InputGroup.isPresent()` with `if
(InputGroup != null)`.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
|