@Override
public void run( Map<String, LogicalInput> inputMap, Map<String, LogicalOutput> outputMap ) throws Exception
{
Collection<Duct> allHeads;
InputSource streamedHead;
try
{
streamGraph = new Hadoop2TezStreamGraph( currentProcess, flowNode, inputMap, outputMap );
allHeads = streamGraph.getHeads();
streamedHead = streamGraph.getStreamedHead();
for( Duct head : allHeads )
LOG.info( "sourcing from: {} streamed: {}", ( (ElementDuct) head ).getFlowElement(), head == streamedHead );
for( Duct tail : streamGraph.getTails() )
LOG.info( "sinking to: {}", ( (ElementDuct) tail ).getFlowElement() );
for( Tap trap : flowNode.getTraps() )
LOG.info( "trapping to: {}", trap );
}
catch( Throwable throwable )
{
if( throwable instanceof CascadingException )
throw (CascadingException) throwable;
throw new FlowException( "internal error during processor configuration", throwable );
}
streamGraph.prepare(); // starts inputs
// wait for shuffle
waitForInputsRead( inputMap );
// user code begins executing from here
long processBeginTime = System.currentTimeMillis();
currentProcess.increment( SliceCounters.Process_Begin_Time, processBeginTime );
Iterator<Duct> iterator = allHeads.iterator();
try
{
try
{
while( iterator.hasNext() )
{
Duct next = iterator.next();
if( next != streamedHead )
( (InputSource) next ).run( null );
}
streamedHead.run( null );
}
catch( OutOfMemoryError | IOException error )
{
throw error;
}