Search in sources :

Example 41 with DAGStatus

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

the class TestAnalyzer method runDAG.

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());
}
Also used : DAGClient(org.apache.tez.dag.api.client.DAGClient) DAGStatus(org.apache.tez.dag.api.client.DAGStatus)

Example 42 with DAGStatus

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

the class DAGClientAMProtocolBlockingPBServerImpl method getDAGStatus.

@Override
public GetDAGStatusResponseProto getDAGStatus(RpcController controller, GetDAGStatusRequestProto request) throws ServiceException {
    UserGroupInformation user = getRPCUser();
    try {
        String dagId = request.getDagId();
        long timeout = request.getTimeout();
        if (!real.getACLManager(dagId).checkDAGViewAccess(user)) {
            throw new AccessControlException("User " + user + " cannot perform DAG view operation");
        }
        real.updateLastHeartbeatTime();
        DAGStatus status;
        status = real.getDAGStatus(dagId, DagTypeConverters.convertStatusGetOptsFromProto(request.getStatusOptionsList()), timeout);
        assert status instanceof DAGStatusBuilder;
        DAGStatusBuilder builder = (DAGStatusBuilder) status;
        return GetDAGStatusResponseProto.newBuilder().setDagStatus(builder.getProto()).build();
    } catch (TezException e) {
        throw wrapException(e);
    }
}
Also used : TezException(org.apache.tez.dag.api.TezException) DAGStatusBuilder(org.apache.tez.dag.api.client.DAGStatusBuilder) AccessControlException(java.security.AccessControlException) DAGStatus(org.apache.tez.dag.api.client.DAGStatus) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation)

Aggregations

DAGStatus (org.apache.tez.dag.api.client.DAGStatus)42 DAGClient (org.apache.tez.dag.api.client.DAGClient)37 DAG (org.apache.tez.dag.api.DAG)30 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)27 Test (org.junit.Test)20 TezClient (org.apache.tez.client.TezClient)18 Vertex (org.apache.tez.dag.api.Vertex)18 Path (org.apache.hadoop.fs.Path)17 SleepProcessor (org.apache.tez.runtime.library.processor.SleepProcessor)9 SleepProcessorConfig (org.apache.tez.runtime.library.processor.SleepProcessor.SleepProcessorConfig)9 FileSystem (org.apache.hadoop.fs.FileSystem)8 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)7 IOException (java.io.IOException)6 TezException (org.apache.tez.dag.api.TezException)6 StatusGetOpts (org.apache.tez.dag.api.client.StatusGetOpts)5 MockContainerLauncher (org.apache.tez.dag.app.MockDAGAppMaster.MockContainerLauncher)5 TreeMap (java.util.TreeMap)4 Configuration (org.apache.hadoop.conf.Configuration)4 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)4 DAGImpl (org.apache.tez.dag.app.dag.impl.DAGImpl)4