本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse类的典型用法代码示例。如果您正苦于以下问题:Java FinishApplicationMasterResponse类的具体用法?Java FinishApplicationMasterResponse怎么用?Java FinishApplicationMasterResponse使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FinishApplicationMasterResponse类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了FinishApplicationMasterResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
if (args[0].equals("success")) {
ApplicationMasterProtocol client = ClientRMProxy.createRMProxy(conf,
ApplicationMasterProtocol.class);
client.registerApplicationMaster(RegisterApplicationMasterRequest
.newInstance(NetUtils.getHostname(), -1, ""));
Thread.sleep(1000);
FinishApplicationMasterResponse resp =
client.finishApplicationMaster(FinishApplicationMasterRequest
.newInstance(FinalApplicationStatus.SUCCEEDED, "success", null));
assertTrue(resp.getIsUnregistered());
System.exit(0);
} else {
System.exit(1);
}
}
示例2: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) throws YarnException,
IOException {
String amrmToken = getAppIdentifier();
Log.info("Finishing application attempt: " + amrmToken);
synchronized (applicationContainerIdMap) {
// Remove the containers that were being tracked for this application
Assert.assertTrue("The application id is NOT registered: "
+ amrmToken, applicationContainerIdMap.containsKey(amrmToken));
List<ContainerId> ids = applicationContainerIdMap.remove(amrmToken);
for (ContainerId c : ids) {
allocatedContainerMap.remove(c);
}
}
return FinishApplicationMasterResponse
.newInstance(request.getFinalApplicationStatus() == FinalApplicationStatus.SUCCEEDED ? true
: false);
}
示例3: testFinishOneApplicationMasterWithSuccess
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test
public void testFinishOneApplicationMasterWithSuccess() throws Exception {
int testAppId = 1;
RegisterApplicationMasterResponse registerResponse =
registerApplicationMaster(testAppId);
Assert.assertNotNull(registerResponse);
Assert.assertEquals(Integer.toString(testAppId),
registerResponse.getQueue());
FinishApplicationMasterResponse finshResponse =
finishApplicationMaster(testAppId,
FinalApplicationStatus.SUCCEEDED);
Assert.assertNotNull(finshResponse);
Assert.assertEquals(true, finshResponse.getIsUnregistered());
}
示例4: testFinishOneApplicationMasterWithFailure
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test
public void testFinishOneApplicationMasterWithFailure() throws Exception {
int testAppId = 1;
RegisterApplicationMasterResponse registerResponse =
registerApplicationMaster(testAppId);
Assert.assertNotNull(registerResponse);
Assert.assertEquals(Integer.toString(testAppId),
registerResponse.getQueue());
FinishApplicationMasterResponse finshResponse =
finishApplicationMaster(testAppId, FinalApplicationStatus.FAILED);
Assert.assertNotNull(finshResponse);
Assert.assertEquals(false, finshResponse.getIsUnregistered());
try {
// Try to finish an application master that is already finished.
finishApplicationMaster(testAppId, FinalApplicationStatus.SUCCEEDED);
Assert
.fail("The request to finish application master should have failed");
} catch (Throwable ex) {
// This is expected. So nothing required here.
LOG.info("Finish registration failed as expected because it was not registered");
}
}
示例5: testAllocateRequestWithNullValues
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test
public void testAllocateRequestWithNullValues() throws Exception {
int testAppId = 1;
RegisterApplicationMasterResponse registerResponse =
registerApplicationMaster(testAppId);
Assert.assertNotNull(registerResponse);
Assert.assertEquals(Integer.toString(testAppId),
registerResponse.getQueue());
AllocateResponse allocateResponse = allocate(testAppId);
Assert.assertNotNull(allocateResponse);
FinishApplicationMasterResponse finshResponse =
finishApplicationMaster(testAppId,
FinalApplicationStatus.SUCCEEDED);
Assert.assertNotNull(finshResponse);
Assert.assertEquals(true, finshResponse.getIsUnregistered());
}
示例6: main
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
if (args[0].equals("success")) {
ApplicationMasterProtocol client = ClientRMProxy.createRMProxy(conf,
ApplicationMasterProtocol.class, true);
client.registerApplicationMaster(RegisterApplicationMasterRequest
.newInstance(NetUtils.getHostname(), -1, ""));
Thread.sleep(1000);
FinishApplicationMasterResponse resp =
client.finishApplicationMaster(FinishApplicationMasterRequest
.newInstance(FinalApplicationStatus.SUCCEEDED, "success", null));
assertTrue(resp.getIsUnregistered());
System.exit(0);
} else {
System.exit(1);
}
}
示例7: unregisterApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public void unregisterApplicationMaster(FinalApplicationStatus appStatus,
String appMessage, String appTrackingUrl) throws YarnException,
IOException {
Preconditions.checkArgument(appStatus != null,
"AppStatus should not be null.");
FinishApplicationMasterRequest request =
FinishApplicationMasterRequest.newInstance(appStatus, appMessage,
appTrackingUrl);
try {
while (true) {
FinishApplicationMasterResponse response =
rmClient.finishApplicationMaster(request);
if (response.getIsUnregistered()) {
break;
}
LOG.info("Waiting for application to be successfully unregistered.");
Thread.sleep(100);
}
} catch (InterruptedException e) {
LOG.info("Interrupted while waiting for application"
+ " to be removed from RMStateStore");
}
}
示例8: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) throws YarnException,
IOException {
FinishApplicationMasterRequestProto requestProto =
((FinishApplicationMasterRequestPBImpl) request).getProto();
try {
return new FinishApplicationMasterResponsePBImpl(
proxy.finishApplicationMaster(null, requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
示例9: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) throws YarnException,
IOException {
// TODO Auto-generated method stub
return null;
}
示例10: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) throws YarnException,
IOException {
resetStartFailoverFlag(true);
// make sure failover has been triggered
Assert.assertTrue(waittingForFailOver());
return createFakeFinishApplicationMasterResponse();
}
示例11: testFinishApplicationMasterOnHA
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Test(timeout = 15000)
public void testFinishApplicationMasterOnHA() throws YarnException,
IOException {
FinishApplicationMasterRequest request =
FinishApplicationMasterRequest.newInstance(
FinalApplicationStatus.SUCCEEDED, "", "");
FinishApplicationMasterResponse response =
amClient.finishApplicationMaster(request);
Assert.assertEquals(response,
this.cluster.createFakeFinishApplicationMasterResponse());
}
示例12: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) throws YarnException, IOException {
ApplicationMasterFinishRequest finishRequest = new ApplicationMasterFinishRequest(
request.getFinalApplicationStatus(), request.getDiagnostics(),
request.getTrackingUrl());
ApplicationMasterFinishResponse response = applicationMaster
.finishApplicationMaster(finishRequest);
return FinishApplicationMasterResponse.newInstance(response
.isUnregistered());
}
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:12,代码来源:HPCApplicationMasterProtocolImpl.java
示例13: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
/**
* This is called by the AMs started on this node to unregister from the RM.
* This method does the initial authorization and then forwards the request to
* the application instance specific intercepter chain.
*/
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request) throws YarnException,
IOException {
LOG.info("Finishing application master. Tracking Url:"
+ request.getTrackingUrl());
RequestInterceptorChainWrapper pipeline =
authorizeAndGetInterceptorChain();
return pipeline.getRootInterceptor().finishApplicationMaster(request);
}
示例14: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
@Override
public FinishApplicationMasterResponse finishApplicationMaster(
final FinishApplicationMasterRequest request) throws YarnException,
IOException {
LOG.info("Forwarding finish application request to "
+ "the real YARN Resource Manager");
return rmClient.finishApplicationMaster(request);
}
示例15: finishApplicationMaster
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse; //导入依赖的package包/类
/**
* Unregisters the application master for specified application id
*
* @param appId
* @param status
* @return
* @throws Exception
* @throws YarnException
* @throws IOException
*/
protected FinishApplicationMasterResponse finishApplicationMaster(
final int appId, final FinalApplicationStatus status)
throws Exception, YarnException, IOException {
final ApplicationUserInfo ugi = getApplicationUserInfo(appId);
return ugi.getUser().doAs(
new PrivilegedExceptionAction<FinishApplicationMasterResponse>() {
@Override
public FinishApplicationMasterResponse run() throws Exception {
final FinishApplicationMasterRequest req =
Records.newRecord(FinishApplicationMasterRequest.class);
req.setDiagnostics("");
req.setTrackingUrl("");
req.setFinalApplicationStatus(status);
FinishApplicationMasterResponse response =
getAMRMProxyService().finishApplicationMaster(req);
getAMRMProxyService().stopApp(
ugi.getAppAttemptId().getApplicationId());
return response;
}
});
}