private boolean startMasterService() { try { mMasterServiceThread.setup( PerfConf.get().DFS_PERF_MASTER_HOSTNAME, PerfConf.get().DFS_PERF_MASTER_PORT); } catch (Exception e) { e.printStackTrace(); LOG.error(e); return false; } mMasterServiceThread.start(); return true; }
private static void abortAllSlaves() { try { java.lang.Runtime.getRuntime().exec(PerfConf.get().DFS_PERF_HOME + "/bin/dfs-perf-abort"); } catch (IOException e) { e.printStackTrace(); LOG.error(e); } }
private boolean waitRegister() { long limitMs = System.currentTimeMillis() + PerfConf.get().UNREGISTER_TIMEOUT_MS; while (System.currentTimeMillis() < limitMs) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); LOG.error(e); return false; } if (mSlaveStatus.allRegistered()) { return true; } } List<String> remains = mSlaveStatus.getUnregisterSlaves(); StringBuffer sbInfo = new StringBuffer("Unregister time out:"); for (String slave : remains) { sbInfo.append(" ").append(slave); } System.err.println(sbInfo.toString()); LOG.error(sbInfo.toString()); return false; }
private boolean waitFinish() { PerfConf conf = PerfConf.get(); while (true) { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); return false; } String info = mSlaveStatus.getFinishStatus(conf.STATUS_DEBUG); System.out.println(info); LOG.info(info); int state = mSlaveStatus.finished(conf.FAILED_THEN_ABORT, conf.FAILED_PERCENTAGE); if (state == -1) { System.err.println("Enough slaves failed. Abort all the slaves."); LOG.error("Enough slaves failed. Abort all the slaves."); return true; } if (state == 1) { return true; } } }