public class NettyShuffleEnvironment extends Object implements ShuffleEnvironment<ResultPartition,SingleInputGate>
ShuffleEnvironment based on netty network communication, local
memory and disk files. The network environment contains the data structures that keep track of
all intermediate results and shuffle data exchanges.| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Tries to shut down all network I/O components.
|
List<SingleInputGate> |
createInputGates(ShuffleIOOwnerContext ownerContext,
PartitionProducerStateProvider partitionProducerStateProvider,
List<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors)
Factory method for the
InputGates to consume result partitions. |
List<ResultPartition> |
createResultPartitionWriters(ShuffleIOOwnerContext ownerContext,
List<ResultPartitionDeploymentDescriptor> resultPartitionDeploymentDescriptors)
Factory method for the
ResultPartitionWriters to produce result
partitions. |
ShuffleIOOwnerContext |
createShuffleIOOwnerContext(String ownerName,
ExecutionAttemptID executionAttemptID,
org.apache.flink.metrics.MetricGroup parentGroup)
Create a context of the shuffle input/output owner used to create partitions or gates
belonging to the owner.
|
BatchShuffleReadBufferPool |
getBatchShuffleReadBufferPool() |
ExecutorService |
getBatchShuffleReadIOExecutor() |
NettyShuffleEnvironmentConfiguration |
getConfiguration() |
ConnectionManager |
getConnectionManager() |
Optional<InputGate> |
getInputGate(InputGateID id) |
NetworkBufferPool |
getNetworkBufferPool() |
Collection<ResultPartitionID> |
getPartitionsOccupyingLocalResources()
Report unreleased partitions.
|
ResultPartitionManager |
getResultPartitionManager() |
boolean |
isClosed() |
void |
registerLegacyNetworkMetrics(org.apache.flink.metrics.MetricGroup metricGroup,
ResultPartitionWriter[] producedPartitions,
InputGate[] inputGates)
已过时。
should be removed in future
|
void |
releasePartitionsLocally(Collection<ResultPartitionID> partitionIds)
Release local resources occupied by the given partitions.
|
int |
start()
Start the internal related services before using the shuffle service environment.
|
boolean |
updatePartitionInfo(ExecutionAttemptID consumerID,
PartitionInfo partitionInfo)
Update a gate with the newly available partition information, previously unknown.
|
@VisibleForTesting public ResultPartitionManager getResultPartitionManager()
@VisibleForTesting public ConnectionManager getConnectionManager()
@VisibleForTesting public NetworkBufferPool getNetworkBufferPool()
@VisibleForTesting public BatchShuffleReadBufferPool getBatchShuffleReadBufferPool()
@VisibleForTesting public ExecutorService getBatchShuffleReadIOExecutor()
@VisibleForTesting public NettyShuffleEnvironmentConfiguration getConfiguration()
@VisibleForTesting public Optional<InputGate> getInputGate(InputGateID id)
public void releasePartitionsLocally(Collection<ResultPartitionID> partitionIds)
ShuffleEnvironmentThis is called for partitions which occupy resources locally (can be checked by ShuffleDescriptor.storesLocalResourcesOn()).
releasePartitionsLocally 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>partitionIds - identifying the partitions to be releasedpublic Collection<ResultPartitionID> getPartitionsOccupyingLocalResources()
getPartitionsOccupyingLocalResources 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>public ShuffleIOOwnerContext createShuffleIOOwnerContext(String ownerName, ExecutionAttemptID executionAttemptID, org.apache.flink.metrics.MetricGroup parentGroup)
ShuffleEnvironmentThis method has to be called only once to avoid duplicated internal metric group registration.
createShuffleIOOwnerContext 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>ownerName - the owner name, used for logsexecutionAttemptID - execution attempt id of the producer or consumerparentGroup - parent of shuffle specific metric grouppublic List<ResultPartition> createResultPartitionWriters(ShuffleIOOwnerContext ownerContext, List<ResultPartitionDeploymentDescriptor> resultPartitionDeploymentDescriptors)
ShuffleEnvironmentResultPartitionWriters to produce result
partitions.
The order of the ResultPartitionWriters in the returned
collection should be the same as the iteration order of the passed resultPartitionDeploymentDescriptors.
createResultPartitionWriters 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>ownerContext - the owner context relevant for partition creationresultPartitionDeploymentDescriptors - descriptors of the partition, produced by the
ownerResultPartitionWriterspublic List<SingleInputGate> createInputGates(ShuffleIOOwnerContext ownerContext, PartitionProducerStateProvider partitionProducerStateProvider, List<InputGateDeploymentDescriptor> inputGateDeploymentDescriptors)
ShuffleEnvironmentInputGates to consume result partitions.
The order of the InputGates in the returned collection should be the
same as the iteration order of the passed inputGateDeploymentDescriptors.
createInputGates 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>ownerContext - the owner context relevant for gate creationpartitionProducerStateProvider - producer state provider to query whether the producer
is ready for consumptioninputGateDeploymentDescriptors - descriptors of the input gates to consumeInputGates@Deprecated public void registerLegacyNetworkMetrics(org.apache.flink.metrics.MetricGroup metricGroup, ResultPartitionWriter[] producedPartitions, InputGate[] inputGates)
Registers legacy metric groups if shuffle service implementation is original default one.
public boolean updatePartitionInfo(ExecutionAttemptID consumerID, PartitionInfo partitionInfo) throws IOException, InterruptedException
ShuffleEnvironmentupdatePartitionInfo 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>consumerID - execution id to distinguish gates with the same id from the different
consumer executionspartitionInfo - information needed to consume the updated partition, e.g. network
locationtrue if the partition has been updated or false if the partition is
not available anymore.IOException - IO problem by the updateInterruptedException - potentially blocking operation was interruptedpublic int start()
throws IOException
ShuffleEnvironmentstart 在接口中 ShuffleEnvironment<ResultPartition,SingleInputGate>IOExceptionpublic void close()
close 在接口中 AutoCloseablepublic boolean isClosed()
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.