public void testShardAndSliceRetriesSuccess() throws Exception {
int shardsCount = 1;
// {input-size, shard-failure, slice-failure}
int[][] runs = { {10, 0, 0}, {10, 2, 0}, {10, 0, 10}, {10, 3, 5}, {10, 0, 22}, {10, 1, 50}};
for (int[] run : runs) {
RandomLongInput input = new RandomLongInput(run[0], shardsCount);
runWithPipeline(new MapReduceSettings.Builder().setMillisPerSlice(0)
.build(), new MapReduceSpecification.Builder<>(input,
new RougeMapper(shardsCount, run[1], run[2]), NoReducer.<String, Long, String>create(),
new NoOutput<String, String>()).setKeyMarshaller(Marshallers.getStringMarshaller())
.setValueMarshaller(Marshallers.getLongMarshaller()).setJobName("Shard-retry test")
.build(), new RougeMapperVerifier(shardsCount, run[0], run[1], run[2]) {
@Override
public void verify(MapReduceResult<String> result) throws Exception {
super.verify(result);
assertNull(result.getOutputResult());
}
});
}
// Disallow slice-retry
runs = new int[][] { {10, 0, 0}, {10, 4, 0}, {10, 0, 4}, {10, 3, 1}, {10, 1, 3}};
for (int[] run : runs) {
RandomLongInput input = new RandomLongInput(run[0], shardsCount);
RougeMapper mapper = new RougeMapper(shardsCount, run[1], run[2]);
mapper.setAllowSliceRetry(false);
runWithPipeline(new MapReduceSettings.Builder().setMillisPerSlice(0)
.build(), new MapReduceSpecification.Builder<>(input, mapper,
NoReducer.<String, Long, String>create(), new NoOutput<String, String>())