|
@@ -31,6 +31,10 @@ import org.apache.hadoop.util.Shell.ShellCommandExecutor;
|
|
|
*/
|
|
|
public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
|
|
|
|
|
|
+ private final static String CONF_HADOOP_MASTERSFILE_NAME="test.system.hdrc.masters.file";
|
|
|
+ private final static String MASTERS_FILE = System.getProperty(CONF_HADOOP_MASTERSFILE_NAME, "masters");
|
|
|
+ private final static String SLAVES_FILE = "slaves";
|
|
|
+
|
|
|
private static final Log LOG = LogFactory
|
|
|
.getLog(HadoopDaemonRemoteCluster.class.getName());
|
|
|
|
|
@@ -173,8 +177,8 @@ public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
|
|
|
}
|
|
|
|
|
|
private void populateDaemons(String confLocation) throws IOException {
|
|
|
- File mastersFile = new File(confLocation, "masters");
|
|
|
- File slavesFile = new File(confLocation, "slaves");
|
|
|
+ File mastersFile = new File(confLocation, MASTERS_FILE);
|
|
|
+ File slavesFile = new File(confLocation, SLAVES_FILE);
|
|
|
BufferedReader reader = null;
|
|
|
try {
|
|
|
reader = new BufferedReader(new FileReader(mastersFile));
|
|
@@ -182,12 +186,16 @@ public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
|
|
|
masterHost = reader.readLine();
|
|
|
if (masterHost != null && !masterHost.trim().isEmpty()) {
|
|
|
master = new ScriptDaemon(masterCommand, masterHost);
|
|
|
+ } else {
|
|
|
+ LOG.error(confLocation + System.getProperty("file.separator", "/") +
|
|
|
+ MASTERS_FILE + " has no content");
|
|
|
}
|
|
|
} finally {
|
|
|
try {
|
|
|
reader.close();
|
|
|
} catch (Exception e) {
|
|
|
- LOG.error("Can't read masters file from " + confLocation);
|
|
|
+ LOG.error("Can't read masters file from " + confLocation +
|
|
|
+ System.getProperty("file.separator", "/") + MASTERS_FILE);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -198,11 +206,16 @@ public class HadoopDaemonRemoteCluster implements ClusterProcessManager {
|
|
|
RemoteProcess slave = new ScriptDaemon(slaveCommand, slaveHost);
|
|
|
slaves.put(slaveHost, slave);
|
|
|
}
|
|
|
+ if (slaves.size() == 0) {
|
|
|
+ LOG.error(confLocation + System.getProperty("file.separator", "/") +
|
|
|
+ SLAVES_FILE + " has no content");
|
|
|
+ }
|
|
|
} finally {
|
|
|
try {
|
|
|
reader.close();
|
|
|
} catch (Exception e) {
|
|
|
- LOG.error("Can't read slaves file from " + confLocation);
|
|
|
+ LOG.error("Can't read slaves file from " + confLocation +
|
|
|
+ System.getProperty("file.separator", "/") + SLAVES_FILE);
|
|
|
}
|
|
|
}
|
|
|
}
|