org.apache.tez.dag.api
Interface EdgeManager


@InterfaceStability.Evolving
public interface EdgeManager

This interface defines the routing of the event between tasks of producer and consumer vertices. The routing is bi-directional. Users can customize the routing by providing an implementation of this interface. Implementations must provide a 0 argument public constructor.


Method Summary
 int getNumDestinationConsumerTasks(int sourceTaskIndex, int numDestinationTasks)
          Get the number of destination tasks that consume data from the source task
 int getNumDestinationTaskPhysicalInputs(int numSourceTasks, int destinationTaskIndex)
          Get the number of physical inputs on the destination task
 int getNumSourceTaskPhysicalOutputs(int numDestinationTasks, int sourceTaskIndex)
          Get the number of physical outputs on the source task
 void initialize(EdgeManagerContext edgeManagerContext)
          Initializes the EdgeManager.
 void routeDataMovementEventToDestination(DataMovementEvent event, int sourceTaskIndex, int numDestinationTasks, Map<Integer,List<Integer>> inputIndicesToTaskIndices)
          Return the routing information to inform consumers about the source task output that is now available.
 int routeInputErrorEventToSource(InputReadErrorEvent event, int destinationTaskIndex)
          Return the source task index to which to send the input error event
 void routeInputSourceTaskFailedEventToDestination(int sourceTaskIndex, int numDestinationTasks, Map<Integer,List<Integer>> inputIndicesToTaskIndices)
          Return the routing information to inform consumers about the failure of a source task whose outputs have been potentially lost.
 

Method Detail

initialize

void initialize(EdgeManagerContext edgeManagerContext)
Initializes the EdgeManager. This method is called in the following circumstances

1. when initializing an Edge Manager for the first time.

2. When an EdgeManager is replaced at runtime. At this point, an EdgeManager instance is created and setup by the user. The initialize method will be called with the original EdgeManagerContext when the edgeManager is replaced.

Parameters:
edgeManagerContext - the context within which this EdgeManager will run. Includes information like configuration which the user may have specified while setting up the edge.

getNumDestinationTaskPhysicalInputs

int getNumDestinationTaskPhysicalInputs(int numSourceTasks,
                                        int destinationTaskIndex)
Get the number of physical inputs on the destination task

Parameters:
numSourceTasks - Total number of source tasks
destinationTaskIndex - Index of destination task for which number of inputs is needed
Returns:
Number of physical inputs on the destination task

getNumSourceTaskPhysicalOutputs

int getNumSourceTaskPhysicalOutputs(int numDestinationTasks,
                                    int sourceTaskIndex)
Get the number of physical outputs on the source task

Parameters:
numDestinationTasks - Total number of destination tasks
sourceTaskIndex - Index of the source task for which number of outputs is needed
Returns:
Number of physical outputs on the source task

routeDataMovementEventToDestination

void routeDataMovementEventToDestination(DataMovementEvent event,
                                         int sourceTaskIndex,
                                         int numDestinationTasks,
                                         Map<Integer,List<Integer>> inputIndicesToTaskIndices)
Return the routing information to inform consumers about the source task output that is now available. The return Map has the routing information. Key is the destination task physical input index and the value is the list of destination task indices for which the key input index will receive the data movement event.

Parameters:
event - Data movement event
sourceTaskIndex - Source task
numDestinationTasks - Total number of destination tasks
inputIndicesToTaskIndices - Map via which the routing information is returned

routeInputSourceTaskFailedEventToDestination

void routeInputSourceTaskFailedEventToDestination(int sourceTaskIndex,
                                                  int numDestinationTasks,
                                                  Map<Integer,List<Integer>> inputIndicesToTaskIndices)
Return the routing information to inform consumers about the failure of a source task whose outputs have been potentially lost. The return Map has the routing information. Key is the destination task physical input index and the value is the list of destination task indices for which the key input index will receive the input failure notification. This method will be called once for every source task failure and information for all affected destinations must be provided in that invocation.

Parameters:
sourceTaskIndex - Source task
numDestinationTasks - Total number of destination tasks
inputIndicesToTaskIndices - Map via which the routing information is returned

getNumDestinationConsumerTasks

int getNumDestinationConsumerTasks(int sourceTaskIndex,
                                   int numDestinationTasks)
Get the number of destination tasks that consume data from the source task

Parameters:
sourceTaskIndex - Source task index
numDestinationTasks - Total number of destination tasks

routeInputErrorEventToSource

int routeInputErrorEventToSource(InputReadErrorEvent event,
                                 int destinationTaskIndex)
Return the source task index to which to send the input error event

Parameters:
event - Input read error event. Has more information about the error
destinationTaskIndex - Destination task that reported the error
Returns:
Index of the source task that created the unavailable input


Copyright © 2014 Apache Software Foundation. All rights reserved.