Search in sources :

Example 11 with DAGEventStartDag

use of org.apache.tez.dag.app.dag.event.DAGEventStartDag in project tez by apache.

the class TestDAGImpl method testInvalidEvent.

@SuppressWarnings("unchecked")
@Test(timeout = 5000)
public void testInvalidEvent() {
    dispatcher.getEventHandler().handle(new DAGEventStartDag(dagId, null));
    dispatcher.await();
    Assert.assertEquals(DAGState.ERROR, dag.getState());
}
Also used : DAGEventStartDag(org.apache.tez.dag.app.dag.event.DAGEventStartDag) Test(org.junit.Test) StateChangeNotifierForTest(org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)

Example 12 with DAGEventStartDag

use of org.apache.tez.dag.app.dag.event.DAGEventStartDag in project tez by apache.

the class DAGAppMaster method startDAGExecution.

private void startDAGExecution(DAG dag, final Map<String, LocalResource> additionalAmResources) throws TezException {
    currentDAG = dag;
    // Try localizing the actual resources.
    List<URL> additionalUrlsForClasspath;
    try {
        additionalUrlsForClasspath = dag.getDagUGI().doAs(new PrivilegedExceptionAction<List<URL>>() {

            @Override
            public List<URL> run() throws Exception {
                return processAdditionalResources(currentDAG.getID(), additionalAmResources);
            }
        });
    } catch (IOException e) {
        throw new TezException(e);
    } catch (InterruptedException e) {
        throw new TezException(e);
    }
    dagIDs.add(currentDAG.getID().toString());
    // End of creating the job.
    ((RunningAppContext) context).setDAG(currentDAG);
    // Send out an event to inform components that a new DAG has been submitted.
    // Information about this DAG is available via the context.
    sendEvent(new DAGAppMasterEvent(DAGAppMasterEventType.NEW_DAG_SUBMITTED));
    // create a job event for job initialization
    DAGEvent initDagEvent = new DAGEvent(currentDAG.getID(), DAGEventType.DAG_INIT);
    // Send init to the job (this does NOT trigger job execution)
    // This is a synchronous call, not an event through dispatcher. We want
    // job-init to be done completely here.
    dagEventDispatcher.handle(initDagEvent);
    // All components have started, start the job.
    /**
     * create a job-start event to get this ball rolling
     */
    DAGEvent startDagEvent = new DAGEventStartDag(currentDAG.getID(), additionalUrlsForClasspath);
    /**
     * send the job-start event. this triggers the job execution.
     */
    sendEvent(startDagEvent);
}
Also used : TezException(org.apache.tez.dag.api.TezException) DAGEvent(org.apache.tez.dag.app.dag.event.DAGEvent) DAGAppMasterEvent(org.apache.tez.dag.app.dag.event.DAGAppMasterEvent) DAGEventStartDag(org.apache.tez.dag.app.dag.event.DAGEventStartDag) PrivilegedExceptionAction(java.security.PrivilegedExceptionAction) IOException(java.io.IOException) URL(java.net.URL)

Aggregations

DAGEventStartDag (org.apache.tez.dag.app.dag.event.DAGEventStartDag)12 StateChangeNotifierForTest (org.apache.tez.dag.app.dag.TestStateChangeNotifier.StateChangeNotifierForTest)8 DAGEvent (org.apache.tez.dag.app.dag.event.DAGEvent)8 Test (org.junit.Test)8 ByteString (com.google.protobuf.ByteString)7 Task (org.apache.tez.dag.app.dag.Task)5 VertexEventRouteEvent (org.apache.tez.dag.app.dag.event.VertexEventRouteEvent)5 EventMetaData (org.apache.tez.runtime.api.impl.EventMetaData)5 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)5 URL (java.net.URL)2 DataMovementEvent (org.apache.tez.runtime.api.events.DataMovementEvent)2 InputReadErrorEvent (org.apache.tez.runtime.api.events.InputReadErrorEvent)2 IOException (java.io.IOException)1 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)1 Condition (java.util.concurrent.locks.Condition)1 ReentrantLock (java.util.concurrent.locks.ReentrantLock)1 TezException (org.apache.tez.dag.api.TezException)1 PlanTaskLocationHint (org.apache.tez.dag.api.records.DAGProtos.PlanTaskLocationHint)1 DAGAppMasterEvent (org.apache.tez.dag.app.dag.event.DAGAppMasterEvent)1 DAGEventTerminateDag (org.apache.tez.dag.app.dag.event.DAGEventTerminateDag)1