/** * Will verify that given task tracker is not blacklisted * @param client tasktracker info * @param conf modified configuration object * @param cluster mrcluster instance * @throws IOException thrown if verification fails */ public void verifyTTNotBlackListed(TTClient client, Configuration conf, MRCluster cluster) throws IOException { int interval = conf.getInt("mapred.healthChecker.interval",0); Assert.assertTrue("Interval cannot be zero.",interval != 0); UtilsForTests.waitFor(interval+2000); String defaultHealthScript = conf.get("mapred.healthChecker.script.path"); Assert.assertTrue("Task tracker is not healthy", nodeHealthStatus(client, true) == true); TaskTrackerStatus status = client.getStatus(); JTClient jclient = cluster.getJTClient(); Assert.assertTrue("Failed to move task tracker to healthy list", jclient.getProxy().isBlackListed(status.getTrackerName()) == false); Assert.assertTrue("Health script was not set",defaultHealthScript != null); }
/** * Verifies that the given task tracker is blacklisted * @param conf modified Configuration object * @param client tasktracker info * @param errorMessage that needs to be asserted * @param cluster mr cluster instance * @throws IOException is thrown when verification fails */ public void verifyTTBlackList(Configuration conf, TTClient client, String errorMessage, MRCluster cluster) throws IOException{ int interval = conf.getInt("mapred.healthChecker.interval",0); Assert.assertTrue("Interval cannot be zero.",interval != 0); UtilsForTests.waitFor(interval+2000); //TaskTrackerStatus status = client.getStatus(); Assert.assertTrue("Task tracker was never blacklisted ", nodeHealthStatus(client, false) == true); TaskTrackerStatus status = client.getStatus(); Assert.assertTrue("The custom error message did not appear", status.getHealthStatus().getHealthReport().trim(). equals(errorMessage)); JTClient jClient = cluster.getJTClient(); Assert.assertTrue("Failed to move task tracker to blacklisted list", jClient.getProxy().isBlackListed(status.getTrackerName()) == true); }
private JobID getJobId(String [] runtimeArgs, String [] otherArgs) throws IOException { JobID jobId = null; final RunStreamJob runSJ; StreamJob streamJob = new StreamJob(); int counter = 0; JTClient jtClient = cluster.getJTClient(); JobClient jobClient = jtClient.getClient(); int totalJobs = jobClient.getAllJobs().length; String [] args = buildArgs(runtimeArgs, otherArgs); cleanup(outputDir, conf); conf.setBoolean("mapreduce.job.complete.cancel.delegation.tokens", false); runSJ = new RunStreamJob(conf, streamJob, args); runSJ.start(); while (counter++ < 60) { if (jobClient.getAllJobs().length - totalJobs == 0) { UtilsForTests.waitFor(1000); } else if (jobClient.getAllJobs()[0].getRunState() == JobStatus.RUNNING) { jobId = jobClient.getAllJobs()[0].getJobID(); break; } else { UtilsForTests.waitFor(1000); } } return jobId; }
public void testFileStatus() throws Exception { UserGroupInformation ugi = UserGroupInformation.createRemoteUser(cluster .getJTClient().getProxy().getDaemonUser()); ugi.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { MRCluster myCluster = null; try { myCluster = MRCluster.createCluster(cluster.getConf()); myCluster.connect(); JTClient jt = myCluster.getJTClient(); String dir = "."; checkFileStatus(jt.getFileStatus(dir, true)); checkFileStatus(jt.listStatus(dir, false, true), dir); for (TTClient tt : myCluster.getTTClients()) { String[] localDirs = tt.getMapredLocalDirs(); for (String localDir : localDirs) { checkFileStatus(tt.listStatus(localDir, true, false), localDir); checkFileStatus(tt.listStatus(localDir, true, true), localDir); } } String systemDir = jt.getClient().getSystemDir().toString(); checkFileStatus(jt.listStatus(systemDir, false, true), systemDir); checkFileStatus(jt.listStatus(jt.getLogDir(), true, true), jt .getLogDir()); } finally { if (myCluster != null) { myCluster.disconnect(); } } return null; } }); }
/** * Gridmix job verification constructor * @param path - path of the gridmix output directory. * @param conf - cluster configuration. * @param jtClient - jobtracker client. */ public GridmixJobVerification(Path path, Configuration conf, JTClient jtClient) { this.path = path; this.conf = conf; this.jtClient = jtClient; }
public GridmixJobSubmission(Configuration conf, JTClient jtClient , Path gridmixDir) { this.conf = conf; this.jtClient = jtClient; this.gridmixDir = gridmixDir; }