// should not throw npe
assertEquals( 0, cascadeStats.getCounterValue( TestEnum.THIRD ) );
assertEquals( 0, cascadeStats.getCounterValue( "FOO", "BAR" ) );
FlowStats flowStats1 = flow1.getFlowStats();
assertNotNull( flowStats1.getID() );
assertEquals( 20, flowStats1.getCounterValue( TestEnum.FIRST ) );
assertEquals( 10, flowStats1.getCounterValue( TestEnum.SECOND ) );
assertEquals( 10, flowStats1.getFlowStepStats().get( 0 ).getCounterValue( TestEnum.FIRST ) );
assertEquals( 10, flowStats1.getFlowStepStats().get( 1 ).getCounterValue( TestEnum.FIRST ) );
// should not throw npe
assertEquals( 0, flowStats1.getCounterValue( TestEnum.THIRD ) );
assertEquals( 0, flowStats1.getCounterValue( "FOO", "BAR" ) );
FlowStats flowStats2 = flow2.getFlowStats();
assertNotNull( flowStats2.getID() );
assertEquals( 20, flowStats2.getCounterValue( TestEnum.FIRST ) );
assertEquals( 10, flowStats2.getCounterValue( TestEnum.SECOND ) );
cascadeStats.captureDetail();
assertEquals( 2, flowStats1.getStepsCount() );
assertEquals( 2, flowStats2.getStepsCount() );
HadoopStepStats stats1 = (HadoopStepStats) flowStats1.getFlowStepStats().get( 0 );
assertNotNull( stats1.getID() );
assertNotNull( stats1.getJobID() );
// assertEquals( 2, stats1.getNumMapTasks() );
// assertEquals( 1, stats1.getNumReducerTasks() );
if( getPlatform().isUseCluster() )
{
assertTrue( stats1.getCounterValue( SliceCounters.Process_Duration ) != 0L );
List<FlowNodeStats> flowNodeStats = stats1.getFlowNodeStats();
assertTrue( flowNodeStats.get( 0 ).getCounterValue( SliceCounters.Process_Duration ) != 0L );
assertEquals( 2, flowNodeStats.size() );
FlowNodeStats mapperNode = flowNodeStats.get( 0 );
FlowNodeStats reducerNode = flowNodeStats.get( 1 );
assertEquals( 4, mapperNode.getChildren().size() );
assertEquals( 1, reducerNode.getChildren().size() );
Collection<FlowSliceStats> children = reducerNode.getChildren();
for( FlowSliceStats flowSliceStats : children )
{
HadoopSliceStats hadoopSliceStats = (HadoopSliceStats) flowSliceStats;
if( hadoopSliceStats.getTaskIDNum() == 0 && hadoopSliceStats.getKind() == HadoopSliceStats.Kind.REDUCER )
assertTrue( hadoopSliceStats.getCounterValue( TestEnum.FIRST ) > 0 ); // in reducer
}
}
HadoopStepStats stats2 = (HadoopStepStats) flowStats2.getFlowStepStats().get( 0 );
assertNotNull( stats2.getID() );
assertNotNull( stats2.getJobID() );
// assertEquals( 2, stats2.getNumMapTasks() );