|
@@ -108,6 +108,9 @@ public class SleepJob extends Configured implements Tool {
|
|
|
|
|
|
public boolean nextKeyValue()
|
|
|
throws IOException {
|
|
|
+ if (count == 0) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
key = new IntWritable();
|
|
|
key.set(emitCount);
|
|
|
int emit = emitPerMapTask / count;
|
|
@@ -123,7 +126,7 @@ public class SleepJob extends Configured implements Tool {
|
|
|
public IntWritable getCurrentValue() { return value; }
|
|
|
public void close() throws IOException { }
|
|
|
public float getProgress() throws IOException {
|
|
|
- return records / ((float)count);
|
|
|
+ return count == 0 ? 100 : records / ((float)count);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
@@ -140,7 +143,7 @@ public class SleepJob extends Configured implements Tool {
|
|
|
Configuration conf = context.getConfiguration();
|
|
|
this.mapSleepCount =
|
|
|
conf.getInt(MAP_SLEEP_COUNT, mapSleepCount);
|
|
|
- this.mapSleepDuration =
|
|
|
+ this.mapSleepDuration = mapSleepCount == 0 ? 0 :
|
|
|
conf.getLong(MAP_SLEEP_TIME , 100) / mapSleepCount;
|
|
|
}
|
|
|
|
|
@@ -177,7 +180,7 @@ public class SleepJob extends Configured implements Tool {
|
|
|
Configuration conf = context.getConfiguration();
|
|
|
this.reduceSleepCount =
|
|
|
conf.getInt(REDUCE_SLEEP_COUNT, reduceSleepCount);
|
|
|
- this.reduceSleepDuration =
|
|
|
+ this.reduceSleepDuration = reduceSleepCount == 0 ? 0 :
|
|
|
conf.getLong(REDUCE_SLEEP_TIME , 100) / reduceSleepCount;
|
|
|
}
|
|
|
|
|
@@ -239,7 +242,7 @@ public class SleepJob extends Configured implements Tool {
|
|
|
ToolRunner.printGenericCommandUsage(System.err);
|
|
|
return 2;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
int numMapper = 1, numReducer = 1;
|
|
|
long mapSleepTime = 100, reduceSleepTime = 100, recSleepTime = 100;
|
|
|
int mapSleepCount = 1, reduceSleepCount = 1;
|