use of org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB in project tez by apache.
the class TezClient method waitForProxy.
private DAGClientAMProtocolBlockingPB waitForProxy() throws IOException, TezException, InterruptedException {
long startTime = System.currentTimeMillis();
long endTime = startTime + (clientTimeout * 1000);
DAGClientAMProtocolBlockingPB proxy = null;
while (true) {
proxy = getAMProxy(sessionAppId);
if (proxy != null) {
break;
}
Thread.sleep(100l);
if (clientTimeout != -1 && System.currentTimeMillis() > endTime) {
break;
}
}
return proxy;
}
use of org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB in project tez by apache.
the class TestTezClient method configureAndCreateTezClient.
TezClientForTest configureAndCreateTezClient(Map<String, LocalResource> lrs, boolean isSession, TezConfiguration conf) throws YarnException, IOException, ServiceException {
if (conf == null) {
conf = new TezConfiguration();
}
conf.setBoolean(TezConfiguration.TEZ_IGNORE_LIB_URIS, true);
conf.setBoolean(TezConfiguration.TEZ_AM_SESSION_MODE, isSession);
TezClientForTest client = new TezClientForTest("test", conf, lrs, null);
ApplicationId appId1 = ApplicationId.newInstance(0, 1);
YarnClient yarnClient = mock(YarnClient.class, RETURNS_DEEP_STUBS);
when(yarnClient.createApplication().getNewApplicationResponse().getApplicationId()).thenReturn(appId1);
when(yarnClient.getApplicationReport(appId1).getYarnApplicationState()).thenReturn(YarnApplicationState.NEW);
when(yarnClient.submitApplication(any(ApplicationSubmissionContext.class))).thenReturn(appId1);
DAGClientAMProtocolBlockingPB sessionAmProxy = mock(DAGClientAMProtocolBlockingPB.class, RETURNS_DEEP_STUBS);
when(sessionAmProxy.getAMStatus(any(RpcController.class), any(GetAMStatusRequestProto.class))).thenReturn(GetAMStatusResponseProto.newBuilder().setStatus(TezAppMasterStatusProto.RUNNING).build());
client.sessionAmProxy = sessionAmProxy;
client.mockTezYarnClient = new TezYarnClient(yarnClient);
client.mockYarnClient = yarnClient;
client.mockAppId = appId1;
return client;
}
Aggregations