Search in sources :

Example 1 with State

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

the class TestMRRJobsDAGApi method testMRRSleepJobViaSession.

// Submits a DAG to AM via RPC after AM has started
@Test(timeout = 60000)
public void testMRRSleepJobViaSession() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException {
    State finalState = testMRRSleepJobDagSubmitCore(true, false, false, false);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
}
Also used : State(org.apache.tez.dag.api.client.DAGStatus.State) YarnApplicationState(org.apache.hadoop.yarn.api.records.YarnApplicationState) Test(org.junit.Test)

Example 2 with State

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

the class TestMRRJobsDAGApi method testAMRelocalizationConflict.

@Test(timeout = 120000)
public void testAMRelocalizationConflict() throws Exception {
    Path relocPath = new Path("/tmp/relocalizationfilefound");
    if (remoteFs.exists(relocPath)) {
        remoteFs.delete(relocPath, true);
    }
    // Run a DAG w/o a file.
    TezClient tezSession = createTezSession();
    State finalState = testMRRSleepJobDagSubmitCore(true, false, false, tezSession, true, MRInputAMSplitGeneratorRelocalizationTest.class, null);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
    Assert.assertFalse(remoteFs.exists(relocPath));
    // Create a bogus TezAppJar directly to HDFS
    LOG.info("Creating jar for relocalization test");
    Path tezAppJar = new Path(MiniTezCluster.APPJAR);
    Path tezAppJarRemote = remoteFs.makeQualified(new Path("/tmp/" + tezAppJar.getName()));
    OutputStream os = remoteFs.create(tezAppJarRemote, true);
    createTestJar(os, RELOCALIZATION_TEST_CLASS_NAME);
    Map<String, LocalResource> additionalResources = new HashMap<String, LocalResource>();
    additionalResources.put("TezAppJar.jar", createLrObjFromPath(tezAppJarRemote));
    try {
        testMRRSleepJobDagSubmitCore(true, false, false, tezSession, true, MRInputAMSplitGeneratorRelocalizationTest.class, additionalResources);
        Assert.fail("should have failed");
    } catch (Exception ex) {
    // expected
    }
    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) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) TezReflectionException(org.apache.tez.dag.api.TezReflectionException) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) TezException(org.apache.tez.dag.api.TezException) TezClient(org.apache.tez.client.TezClient) LocalResource(org.apache.hadoop.yarn.api.records.LocalResource) Test(org.junit.Test)

Example 3 with State

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

the class TestMRRJobsDAGApi method testMultipleMRRSleepJobViaSession.

// Submits a DAG to AM via RPC after AM has started
@Test(timeout = 120000)
public void testMultipleMRRSleepJobViaSession() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException {
    Path remoteStagingDir = remoteFs.makeQualified(new Path("/tmp", String.valueOf(new Random().nextInt(100000))));
    remoteFs.mkdirs(remoteStagingDir);
    TezConfiguration tezConf = new TezConfiguration(mrrTezCluster.getConfig());
    tezConf.set(TezConfiguration.TEZ_AM_STAGING_DIR, remoteStagingDir.toString());
    TezClient tezSession = TezClient.create("testsession", tezConf, true);
    tezSession.start();
    Assert.assertEquals(TezAppMasterStatus.INITIALIZING, tezSession.getAppMasterStatus());
    State finalState = testMRRSleepJobDagSubmitCore(true, false, false, tezSession, false, null, null);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
    Assert.assertEquals(TezAppMasterStatus.READY, tezSession.getAppMasterStatus());
    finalState = testMRRSleepJobDagSubmitCore(true, false, false, tezSession, false, null, null);
    Assert.assertEquals(DAGStatus.State.SUCCEEDED, finalState);
    Assert.assertEquals(TezAppMasterStatus.READY, tezSession.getAppMasterStatus());
    stopAndVerifyYarnApp(tezSession);
}
Also used : Path(org.apache.hadoop.fs.Path) Random(java.util.Random) State(org.apache.tez.dag.api.client.DAGStatus.State) YarnApplicationState(org.apache.hadoop.yarn.api.records.YarnApplicationState) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) TezClient(org.apache.tez.client.TezClient) Test(org.junit.Test)

Example 4 with State

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

the class TestMRRJobsDAGApi method testMRRSleepJobDagSubmitAndKillViaRPC.

// Submits a simple 5 stage sleep job using tez session. Then kills it.
@Test(timeout = 60000)
public void testMRRSleepJobDagSubmitAndKillViaRPC() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException {
    State finalState = testMRRSleepJobDagSubmitCore(true, true, false, false);
    Assert.assertEquals(DAGStatus.State.KILLED, 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 5 with State

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

the class TestMRRJobsDAGApi method testMRRSleepJobDagSubmitAndKill.

// Submits a simple 5 stage sleep job using the DAG submit API. Then kills it.
@Test(timeout = 60000)
public void testMRRSleepJobDagSubmitAndKill() throws IOException, InterruptedException, TezException, ClassNotFoundException, YarnException {
    State finalState = testMRRSleepJobDagSubmitCore(false, true, false, false);
    Assert.assertEquals(DAGStatus.State.KILLED, 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)

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