Search in sources :

Example 6 with State

use of org.apache.tez.dag.api.client.DAGStatus.State in project tez by apache.

the class TestMRRJobsDAGApi method testMRRSleepJobDagSubmit.

// Submits a simple 5 stage sleep job using the DAG submit API instead of job
// client.
@Test(timeout = 60000)
public void testMRRSleepJobDagSubmit() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException {
    State finalState = testMRRSleepJobDagSubmitCore(false, false, false, false);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
// TODO Add additional checks for tracking URL etc. - once it's exposed by
// the DAG API.
}
Also used : State(org.apache.tez.dag.api.client.DAGStatus.State) YarnApplicationState(org.apache.hadoop.yarn.api.records.YarnApplicationState) Test(org.junit.Test)

Example 7 with State

use of org.apache.tez.dag.api.client.DAGStatus.State in project tez by apache.

the class TestMRRJobsDAGApi method testAMRelocalization.

// Submit 2 jobs via RPC using a custom initializer. The second job is submitted with an
// additional local resource, which is verified by the initializer.
@Test(timeout = 120000)
public void testAMRelocalization() throws Exception {
    Path relocPath = new Path("/tmp/relocalizationfilefound");
    if (remoteFs.exists(relocPath)) {
        remoteFs.delete(relocPath, true);
    }
    TezClient tezSession = createTezSession();
    State finalState = testMRRSleepJobDagSubmitCore(true, false, false, tezSession, true, MRInputAMSplitGeneratorRelocalizationTest.class, null);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
    Assert.assertFalse(remoteFs.exists(new Path("/tmp/relocalizationfilefound")));
    // Start the second job with some additional resources.
    // Create a test jar directly to HDFS
    LOG.info("Creating jar for relocalization test");
    Path relocFilePath = new Path("/tmp/test.jar");
    relocFilePath = remoteFs.makeQualified(relocFilePath);
    OutputStream os = remoteFs.create(relocFilePath, true);
    createTestJar(os, RELOCALIZATION_TEST_CLASS_NAME);
    // Also upload one of Tez's own JARs to HDFS and add as resource; should be ignored
    Path tezAppJar = new Path(MiniTezCluster.APPJAR);
    Path tezAppJarRemote = remoteFs.makeQualified(new Path("/tmp/" + tezAppJar.getName()));
    remoteFs.copyFromLocalFile(tezAppJar, tezAppJarRemote);
    Map<String, LocalResource> additionalResources = new HashMap<String, LocalResource>();
    additionalResources.put("test.jar", createLrObjFromPath(relocFilePath));
    additionalResources.put("TezAppJar.jar", createLrObjFromPath(tezAppJarRemote));
    Assert.assertEquals(TezAppMasterStatus.READY, tezSession.getAppMasterStatus());
    finalState = testMRRSleepJobDagSubmitCore(true, false, false, tezSession, true, MRInputAMSplitGeneratorRelocalizationTest.class, additionalResources);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
    Assert.assertEquals(TezAppMasterStatus.READY, tezSession.getAppMasterStatus());
    Assert.assertTrue(remoteFs.exists(new Path("/tmp/relocalizationfilefound")));
    stopAndVerifyYarnApp(tezSession);
}
Also used : Path(org.apache.hadoop.fs.Path) HashMap(java.util.HashMap) State(org.apache.tez.dag.api.client.DAGStatus.State) YarnApplicationState(org.apache.hadoop.yarn.api.records.YarnApplicationState) FSDataOutputStream(org.apache.hadoop.fs.FSDataOutputStream) JarOutputStream(java.util.jar.JarOutputStream) OutputStream(java.io.OutputStream) TezClient(org.apache.tez.client.TezClient) LocalResource(org.apache.hadoop.yarn.api.records.LocalResource) Test(org.junit.Test)

Aggregations

YarnApplicationState (org.apache.hadoop.yarn.api.records.YarnApplicationState)7 State (org.apache.tez.dag.api.client.DAGStatus.State)7 Test (org.junit.Test)7 Path (org.apache.hadoop.fs.Path)3 TezClient (org.apache.tez.client.TezClient)3 OutputStream (java.io.OutputStream)2 HashMap (java.util.HashMap)2 JarOutputStream (java.util.jar.JarOutputStream)2 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)2 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)2 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 Random (java.util.Random)1 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)1 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)1 TezException (org.apache.tez.dag.api.TezException)1 TezReflectionException (org.apache.tez.dag.api.TezReflectionException)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1