use of org.apache.flink.runtime.executiongraph.failover.flip1.ResultPartitionAvailabilityChecker in project flink by apache.
the class ExecutionGraphResultPartitionAvailabilityCheckerTest method testPartitionAvailabilityCheck.
@Test
public void testPartitionAvailabilityCheck() {
final IntermediateResultPartitionID irp1ID = new IntermediateResultPartitionID();
final IntermediateResultPartitionID irp2ID = new IntermediateResultPartitionID();
final IntermediateResultPartitionID irp3ID = new IntermediateResultPartitionID();
final IntermediateResultPartitionID irp4ID = new IntermediateResultPartitionID();
final Map<IntermediateResultPartitionID, Boolean> expectedAvailability = new HashMap<IntermediateResultPartitionID, Boolean>() {
{
put(irp1ID, true);
put(irp2ID, false);
put(irp3ID, false);
put(irp4ID, true);
}
};
// let the partition tracker respect the expected availability result
final TestingJobMasterPartitionTracker partitionTracker = new TestingJobMasterPartitionTracker();
partitionTracker.setIsPartitionTrackedFunction(rpID -> expectedAvailability.get(rpID.getPartitionId()));
// the execution attempt ID should make no difference in this case
final Function<IntermediateResultPartitionID, ResultPartitionID> partitionIDMapper = intermediateResultPartitionID -> new ResultPartitionID(intermediateResultPartitionID, new ExecutionAttemptID());
final ResultPartitionAvailabilityChecker resultPartitionAvailabilityChecker = new ExecutionGraphResultPartitionAvailabilityChecker(partitionIDMapper, partitionTracker);
for (IntermediateResultPartitionID irpID : expectedAvailability.keySet()) {
assertEquals(expectedAvailability.get(irpID), resultPartitionAvailabilityChecker.isAvailable(irpID));
}
}
Aggregations