HDFS-14825. [Dynamometer] Workload doesn't start unless an absolute path of Mapper class given. (#1693)
This commit is contained in:
parent
f1ab7f18c4
commit
54e760511a
@ -168,16 +168,27 @@ public static void main(String[] args) throws Exception {
|
|||||||
// recognize this
|
// recognize this
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Class<? extends WorkloadMapper<?, ?, ?, ?>> getMapperClass(
|
private Class<? extends WorkloadMapper<?, ?, ?, ?>> getMapperClass(
|
||||||
String className) throws ClassNotFoundException {
|
String className) {
|
||||||
if (!className.contains(".")) {
|
String[] potentialQualifiedClassNames = {
|
||||||
className = WorkloadDriver.class.getPackage().getName() + "." + className;
|
WorkloadDriver.class.getPackage().getName() + "." + className,
|
||||||
|
AuditReplayMapper.class.getPackage().getName() + "." + className,
|
||||||
|
className
|
||||||
|
};
|
||||||
|
for (String qualifiedClassName : potentialQualifiedClassNames) {
|
||||||
|
Class<?> mapperClass;
|
||||||
|
try {
|
||||||
|
mapperClass = getConf().getClassByName(qualifiedClassName);
|
||||||
|
} catch (ClassNotFoundException cnfe) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!WorkloadMapper.class.isAssignableFrom(mapperClass)) {
|
||||||
|
throw new IllegalArgumentException(className + " is not a subclass of "
|
||||||
|
+ WorkloadMapper.class.getCanonicalName());
|
||||||
|
}
|
||||||
|
return (Class<? extends WorkloadMapper<?, ?, ?, ?>>) mapperClass;
|
||||||
}
|
}
|
||||||
Class<?> mapperClass = getConf().getClassByName(className);
|
throw new IllegalArgumentException("Unable to find workload mapper class: "
|
||||||
if (!WorkloadMapper.class.isAssignableFrom(mapperClass)) {
|
+ className);
|
||||||
throw new IllegalArgumentException(className + " is not a subclass of "
|
|
||||||
+ WorkloadMapper.class.getCanonicalName());
|
|
||||||
}
|
|
||||||
return (Class<? extends WorkloadMapper<?, ?, ?, ?>>) mapperClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getMapperUsageInfo(String mapperClassName)
|
private String getMapperUsageInfo(String mapperClassName)
|
||||||
|
Loading…
Reference in New Issue
Block a user