Java Code Examples for org.apache.tez.dag.api.client.DAGStatus#isCompleted()
The following examples show how to use
org.apache.tez.dag.api.client.DAGStatus#isCompleted() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestAnalyzer.java From tez with Apache License 2.0 | 6 votes |
private void runDAG(DAG dag, DAGStatus.State finalState) throws Exception { tezSession.waitTillReady(); LOG.info("ABC Running DAG name: " + dag.getName()); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appContext: " + dagClient.getExecutionContext() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); }
Example 2
Source File: TestDAGRecovery2.java From tez with Apache License 2.0 | 6 votes |
void runDAGAndVerify(DAG dag, DAGStatus.State finalState, TezClient session) throws Exception { session.waitTillReady(); DAGClient dagClient = session.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appContext: " + dagClient.getExecutionContext() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); }
Example 3
Source File: TestDAGRecovery2.java From incubator-tez with Apache License 2.0 | 6 votes |
void runDAGAndVerify(DAG dag, DAGStatus.State finalState, TezClient session) throws Exception { session.waitTillReady(); DAGClient dagClient = session.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appId: " + dagClient.getApplicationId() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); }
Example 4
Source File: TestFaultTolerance.java From tez with Apache License 2.0 | 6 votes |
void runDAGAndVerify(DAG dag, DAGStatus.State finalState, int checkFailedAttempts, String diagnostics) throws Exception { tezSession.waitTillReady(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appContext: " + dagClient.getExecutionContext() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); if (checkFailedAttempts > 0) { Assert.assertEquals(checkFailedAttempts, dagStatus.getDAGProgress().getFailedTaskAttemptCount()); } if (diagnostics != null) { Assert.assertNotNull(dagStatus.getDiagnostics()); Assert.assertTrue(Joiner.on(":").join(dagStatus.getDiagnostics()).contains(diagnostics)); } }
Example 5
Source File: TestFaultTolerance.java From incubator-tez with Apache License 2.0 | 5 votes |
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception { tezSession.waitTillReady(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appId: " + dagClient.getApplicationId() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); }
Example 6
Source File: TestATSHistoryWithMiniCluster.java From tez with Apache License 2.0 | 5 votes |
@Test (timeout=50000) public void testDisabledACls() throws Exception { TezClient tezSession = null; try { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessor"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(256, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); tezConf.setBoolean(TezConfiguration.TEZ_AM_ALLOW_DISABLED_TIMELINE_DOMAINS, true); tezConf.set(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, ATSHistoryLoggingService.class.getName()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); tezSession = TezClient.create("TezSleepProcessor", tezConf, true); tezSession.start(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); } finally { if (tezSession != null) { tezSession.stop(); } } }
Example 7
Source File: TestDAGRecovery.java From tez with Apache License 2.0 | 5 votes |
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception { tezSession.waitTillReady(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null, 10); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appContext: " + dagClient.getExecutionContext() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); }
Example 8
Source File: FaultToleranceTestRunner.java From tez with Apache License 2.0 | 5 votes |
boolean run(Configuration conf, String className, String confFilePath) throws Exception { this.conf = conf; setup(); try { tezSession.waitTillReady(); DAG dag = getDAG(className, confFilePath); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { System.out.println("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appContext: " + dagClient.getExecutionContext() + " Current state: " + dagStatus.getState()); Thread.sleep(500); dagStatus = dagClient.getDAGStatus(null); } if (dagStatus.getState() == DAGStatus.State.SUCCEEDED) { return true; } } finally { tearDown(); } return false; }
Example 9
Source File: TestMRRJobsDAGApi.java From tez with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testSleepJob() throws TezException, IOException, InterruptedException { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessor"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(1024, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); TezClient tezSession = TezClient.create("TezSleepProcessor", tezConf, false); tezSession.start(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } dagStatus = dagClient.getDAGStatus(Sets.newHashSet(StatusGetOpts.GET_COUNTERS)); assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); assertNotNull(dagStatus.getDAGCounters()); assertNotNull(dagStatus.getDAGCounters().getGroup(FileSystemCounter.class.getName())); assertNotNull(dagStatus.getDAGCounters().findCounter(TaskCounter.GC_TIME_MILLIS)); ExampleDriver.printDAGStatus(dagClient, new String[] { "SleepVertex" }, true, true); tezSession.stop(); }
Example 10
Source File: TestDAGRecovery.java From incubator-tez with Apache License 2.0 | 5 votes |
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception { tezSession.waitTillReady(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appId: " + dagClient.getApplicationId() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(finalState, dagStatus.getState()); }
Example 11
Source File: TestTezJobs.java From incubator-tez with Apache License 2.0 | 5 votes |
@Test public void testNonDefaultFSStagingDir() throws Exception { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = new DAG("TezSleepProcessor"); Vertex vertex = new Vertex("SleepVertex", new ProcessorDescriptor( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(1024, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); Path stagingDir = new Path(TEST_ROOT_DIR, "testNonDefaultFSStagingDir" + String.valueOf(random.nextInt(100000))); FileSystem localFs = FileSystem.getLocal(tezConf); stagingDir = localFs.makeQualified(stagingDir); localFs.mkdirs(stagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, stagingDir.toString()); TezClient tezSession = new TezClient("TezSleepProcessor", tezConf, false); tezSession.start(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } dagStatus = dagClient.getDAGStatus(Sets.newHashSet(StatusGetOpts.GET_COUNTERS)); assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); assertNotNull(dagStatus.getDAGCounters()); assertNotNull(dagStatus.getDAGCounters().getGroup(FileSystemCounter.class.getName())); assertNotNull(dagStatus.getDAGCounters().findCounter(TaskCounter.GC_TIME_MILLIS)); ExampleDriver.printDAGStatus(dagClient, new String[] { "SleepVertex" }, true, true); tezSession.stop(); }
Example 12
Source File: TestTezJobs.java From incubator-tez with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testSleepJob() throws TezException, IOException, InterruptedException { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = new DAG("TezSleepProcessor"); Vertex vertex = new Vertex("SleepVertex", new ProcessorDescriptor( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(1024, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); TezClient tezSession = new TezClient("TezSleepProcessor", tezConf, false); tezSession.start(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } dagStatus = dagClient.getDAGStatus(Sets.newHashSet(StatusGetOpts.GET_COUNTERS)); assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); assertNotNull(dagStatus.getDAGCounters()); assertNotNull(dagStatus.getDAGCounters().getGroup(FileSystemCounter.class.getName())); assertNotNull(dagStatus.getDAGCounters().findCounter(TaskCounter.GC_TIME_MILLIS)); ExampleDriver.printDAGStatus(dagClient, new String[] { "SleepVertex" }, true, true); tezSession.stop(); }
Example 13
Source File: FaultToleranceTestRunner.java From incubator-tez with Apache License 2.0 | 5 votes |
boolean run(Configuration conf, String className, String confFilePath) throws Exception { this.conf = conf; setup(); try { tezSession.waitTillReady(); DAG dag = getDAG(className, confFilePath); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { System.out.println("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG appId: " + dagClient.getApplicationId() + " Current state: " + dagStatus.getState()); Thread.sleep(500); dagStatus = dagClient.getDAGStatus(null); } if (dagStatus.getState() == DAGStatus.State.SUCCEEDED) { return true; } } finally { tearDown(); } return false; }
Example 14
Source File: TestATSHistoryWithACLs.java From tez with Apache License 2.0 | 4 votes |
@Test (timeout=50000) public void testDAGACls() throws Exception { TezClient tezSession = null; ApplicationId applicationId; String viewAcls = "nobody nobody_group"; try { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessor"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(256, 1)); dag.addVertex(vertex); DAGAccessControls accessControls = new DAGAccessControls(); accessControls.setUsersWithViewACLs(Collections.singleton("nobody2")); accessControls.setGroupsWithViewACLs(Collections.singleton("nobody_group2")); dag.setAccessControls(accessControls); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); tezConf.set(TezConfiguration.TEZ_AM_VIEW_ACLS, viewAcls); tezConf.set(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, ATSHistoryLoggingService.class.getName()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); tezSession = TezClient.create("TezSleepProcessor", tezConf, true); tezSession.start(); applicationId = tezSession.getAppMasterApplicationId(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); } finally { if (tezSession != null) { tezSession.stop(); } } TimelineDomain timelineDomain = getDomain( ATSHistoryACLPolicyManager.DOMAIN_ID_PREFIX + applicationId.toString()); verifyDomainACLs(timelineDomain, Collections.singleton("nobody"), Collections.singleton("nobody_group")); timelineDomain = getDomain(ATSHistoryACLPolicyManager.DOMAIN_ID_PREFIX + applicationId.toString() + "_1"); verifyDomainACLs(timelineDomain, Sets.newHashSet("nobody", "nobody2"), Sets.newHashSet("nobody_group", "nobody_group2")); verifyEntityDomains(applicationId, false); }
Example 15
Source File: TestMRRJobsDAGApi.java From tez with Apache License 2.0 | 4 votes |
@Test(timeout = 60000) public void testHistoryLogging() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessorHistoryLogging"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 2, Resource.newInstance(1024, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); FileSystem localFs = FileSystem.getLocal(tezConf); Path historyLogDir = new Path(TEST_ROOT_DIR, "testHistoryLogging"); localFs.mkdirs(historyLogDir); tezConf.set(TezConfiguration.TEZ_SIMPLE_HISTORY_LOGGING_DIR, localFs.makeQualified(historyLogDir).toString()); tezConf.setBoolean(TezConfiguration.TEZ_AM_SESSION_MODE, false); TezClient tezSession = TezClient.create("TezSleepProcessorHistoryLogging", tezConf); tezSession.start(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); FileStatus historyLogFileStatus = null; for (FileStatus fileStatus : localFs.listStatus(historyLogDir)) { if (fileStatus.isDirectory()) { continue; } Path p = fileStatus.getPath(); if (p.getName().startsWith(SimpleHistoryLoggingService.LOG_FILE_NAME_PREFIX)) { historyLogFileStatus = fileStatus; break; } } Assert.assertNotNull(historyLogFileStatus); Assert.assertTrue(historyLogFileStatus.getLen() > 0); tezSession.stop(); }
Example 16
Source File: TestTezJobs.java From tez with Apache License 2.0 | 4 votes |
@Test (timeout=60000) public void testVertexOrder() throws Exception { TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); TezClient tezClient = TezClient.create("TestVertexOrder", tezConf); tezClient.start(); try { DAG dag = SimpleTestDAG.createDAGForVertexOrder("dag1", conf); DAGClient dagClient = tezClient.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for dag to complete. Sleeping for 500ms." + " DAG name: " + dag.getName() + " DAG context: " + dagClient.getExecutionContext() + " Current state: " + dagStatus.getState()); Thread.sleep(100); dagStatus = dagClient.getDAGStatus(null); } Assert.assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); // verify vertex order Set<String> resultVertices = dagStatus.getVertexProgress().keySet(); Assert.assertEquals(6, resultVertices.size()); int i = 0; for (String vertexName : resultVertices){ if (i <= 1){ Assert.assertTrue( vertexName.equals("v1") || vertexName.equals("v2")); } else if (i == 2){ Assert.assertTrue( vertexName.equals("v3")); } else if (i <= 4){ Assert.assertTrue( vertexName.equals("v4") || vertexName.equals("v5")); } else { Assert.assertTrue( vertexName.equals("v6")); } i++; } } finally { if (tezClient != null) { tezClient.stop(); } } }
Example 17
Source File: TestTezJobs.java From incubator-tez with Apache License 2.0 | 4 votes |
@Test(timeout = 60000) public void testHistoryLogging() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = new DAG("TezSleepProcessorHistoryLogging"); Vertex vertex = new Vertex("SleepVertex", new ProcessorDescriptor( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 2, Resource.newInstance(1024, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); FileSystem localFs = FileSystem.getLocal(tezConf); Path historyLogDir = new Path(TEST_ROOT_DIR, "testHistoryLogging"); localFs.mkdirs(historyLogDir); tezConf.set(TezConfiguration.TEZ_SIMPLE_HISTORY_LOGGING_DIR, localFs.makeQualified(historyLogDir).toString()); tezConf.setBoolean(TezConfiguration.TEZ_AM_SESSION_MODE, false); TezClient tezSession = new TezClient("TezSleepProcessorHistoryLogging", tezConf); tezSession.start(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); FileStatus historyLogFileStatus = null; for (FileStatus fileStatus : localFs.listStatus(historyLogDir)) { if (fileStatus.isDirectory()) { continue; } Path p = fileStatus.getPath(); if (p.getName().startsWith(SimpleHistoryLoggingService.LOG_FILE_NAME_PREFIX)) { historyLogFileStatus = fileStatus; break; } } Assert.assertNotNull(historyLogFileStatus); Assert.assertTrue(historyLogFileStatus.getLen() > 0); tezSession.stop(); }
Example 18
Source File: TestATSHistoryV15.java From tez with Apache License 2.0 | 4 votes |
@Test(timeout=50000) public void testSimpleDAG() throws Exception { TezClient tezSession = null; ApplicationId applicationId; String viewAcls = "nobody nobody_group"; try { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessor"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(256, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); tezConf.set(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SUMMARY_ENTITY_TYPES, "TEZ_DAG_ID"); tezConf.set(TezConfiguration.TEZ_AM_VIEW_ACLS, viewAcls); tezConf.set(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, ATSV15HistoryLoggingService.class.getName()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); tezSession = TezClient.create("TezSleepProcessor", tezConf, true); tezSession.start(); applicationId = tezSession.getAppMasterApplicationId(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); // Verify HDFS data int count = verifyATSDataOnHDFS(atsActivePath, applicationId); Assert.assertEquals("Count is: " + count, 2, count); } finally { if (tezSession != null) { tezSession.stop(); } } }
Example 19
Source File: TestATSHistoryV15.java From tez with Apache License 2.0 | 4 votes |
@Test public void testATSLogLevelNone() throws Exception { TezClient tezSession = null; ApplicationId applicationId; String viewAcls = "nobody nobody_group"; try { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessor"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(256, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); tezConf.set(YarnConfiguration.TIMELINE_SERVICE_ENTITYGROUP_FS_STORE_SUMMARY_ENTITY_TYPES, "TEZ_DAG_ID"); tezConf.set(TezConfiguration.TEZ_AM_VIEW_ACLS, viewAcls); tezConf.set(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, ATSV15HistoryLoggingService.class.getName()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); tezSession = TezClient.create("TezSleepProcessor", tezConf, true); tezSession.start(); applicationId = tezSession.getAppMasterApplicationId(); dag.setHistoryLogLevel(HistoryLogLevel.NONE); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); // Verify HDFS data int count = verifyATSDataOnHDFS(atsActivePath, applicationId); Assert.assertEquals("Count is: " + count, 1, count); } finally { if (tezSession != null) { tezSession.stop(); } } }
Example 20
Source File: TestATSHistoryWithACLs.java From tez with Apache License 2.0 | 4 votes |
@Test (timeout=50000) public void testSimpleAMACls() throws Exception { TezClient tezSession = null; ApplicationId applicationId; String viewAcls = "nobody nobody_group"; try { SleepProcessorConfig spConf = new SleepProcessorConfig(1); DAG dag = DAG.create("TezSleepProcessor"); Vertex vertex = Vertex.create("SleepVertex", ProcessorDescriptor.create( SleepProcessor.class.getName()).setUserPayload(spConf.toUserPayload()), 1, Resource.newInstance(256, 1)); dag.addVertex(vertex); TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig()); tezConf.set(TezConfiguration.TEZ_AM_VIEW_ACLS, viewAcls); tezConf.set(TezConfiguration.TEZ_HISTORY_LOGGING_SERVICE_CLASS, ATSHistoryLoggingService.class.getName()); Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(random .nextInt(100000)))); remoteFs.mkdirs(remoteStagingDir); tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString()); tezSession = TezClient.create("TezSleepProcessor", tezConf, true); tezSession.start(); applicationId = tezSession.getAppMasterApplicationId(); DAGClient dagClient = tezSession.submitDAG(dag); DAGStatus dagStatus = dagClient.getDAGStatus(null); while (!dagStatus.isCompleted()) { LOG.info("Waiting for job to complete. Sleeping for 500ms." + " Current state: " + dagStatus.getState()); Thread.sleep(500l); dagStatus = dagClient.getDAGStatus(null); } assertEquals(DAGStatus.State.SUCCEEDED, dagStatus.getState()); } finally { if (tezSession != null) { tezSession.stop(); } } TimelineDomain timelineDomain = getDomain( ATSHistoryACLPolicyManager.DOMAIN_ID_PREFIX + applicationId.toString()); verifyDomainACLs(timelineDomain, Collections.singleton("nobody"), Collections.singleton("nobody_group")); verifyEntityDomains(applicationId, true); }