use of org.apache.tez.dag.api.client.DAGStatusBuilder in project tez by apache.
the class DAGImpl method getDAGStatus.
// monitoring apis
@Override
public DAGStatusBuilder getDAGStatus(Set<StatusGetOpts> statusOptions) {
DAGStatusBuilder status = new DAGStatusBuilder();
int totalTaskCount = 0;
int totalSucceededTaskCount = 0;
int totalRunningTaskCount = 0;
int totalFailedTaskCount = 0;
int totalKilledTaskCount = 0;
int totalFailedTaskAttemptCount = 0;
int totalKilledTaskAttemptCount = 0;
int totalRejectedTaskAttemptCount = 0;
readLock.lock();
try {
for (Map.Entry<String, Vertex> entry : vertexMap.entrySet()) {
ProgressBuilder progress = entry.getValue().getVertexProgress();
status.addVertexProgress(entry.getKey(), progress);
totalTaskCount += progress.getTotalTaskCount();
totalSucceededTaskCount += progress.getSucceededTaskCount();
totalRunningTaskCount += progress.getRunningTaskCount();
totalFailedTaskCount += progress.getFailedTaskCount();
totalKilledTaskCount += progress.getKilledTaskCount();
totalFailedTaskAttemptCount += progress.getFailedTaskAttemptCount();
totalKilledTaskAttemptCount += progress.getKilledTaskAttemptCount();
totalRejectedTaskAttemptCount += progress.getRejectedTaskAttemptCount();
}
ProgressBuilder dagProgress = new ProgressBuilder();
dagProgress.setTotalTaskCount(totalTaskCount);
dagProgress.setSucceededTaskCount(totalSucceededTaskCount);
dagProgress.setRunningTaskCount(totalRunningTaskCount);
dagProgress.setFailedTaskCount(totalFailedTaskCount);
dagProgress.setKilledTaskCount(totalKilledTaskCount);
dagProgress.setFailedTaskAttemptCount(totalFailedTaskAttemptCount);
dagProgress.setKilledTaskAttemptCount(totalKilledTaskAttemptCount);
dagProgress.setRejectedTaskAttemptCount(totalRejectedTaskAttemptCount);
status.setState(getState());
status.setDiagnostics(diagnostics);
status.setDAGProgress(dagProgress);
if (statusOptions.contains(StatusGetOpts.GET_COUNTERS)) {
status.setDAGCounters(getAllCounters());
}
return status;
} finally {
readLock.unlock();
}
}
use of org.apache.tez.dag.api.client.DAGStatusBuilder in project tez by apache.
the class TestDAGImpl method testGetDAGStatusWithWait.
@SuppressWarnings("unchecked")
@Test(timeout = 10000)
public void testGetDAGStatusWithWait() throws TezException {
initDAG(dag);
startDAG(dag);
dispatcher.await();
// All vertices except one succeed
for (int i = 0; i < dag.getVertices().size() - 1; ++i) {
dispatcher.getEventHandler().handle(new DAGEventVertexCompleted(TezVertexID.getInstance(dagId, i), VertexState.SUCCEEDED));
}
dispatcher.await();
Assert.assertEquals(DAGState.RUNNING, dag.getState());
Assert.assertEquals(5, dag.getSuccessfulVertices());
long dagStatusStartTime = System.currentTimeMillis();
DAGStatusBuilder dagStatus = dag.getDAGStatus(EnumSet.noneOf(StatusGetOpts.class), 2000l);
long dagStatusEndTime = System.currentTimeMillis();
long diff = dagStatusEndTime - dagStatusStartTime;
Assert.assertTrue(diff > 1500 && diff < 2500);
Assert.assertEquals(DAGStatusBuilder.State.RUNNING, dagStatus.getState());
}
use of org.apache.tez.dag.api.client.DAGStatusBuilder 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);
}
}
Aggregations