use of org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse in project hadoop by apache.
the class SCMAdminProtocolService method runCleanerTask.
@Override
public RunSharedCacheCleanerTaskResponse runCleanerTask(RunSharedCacheCleanerTaskRequest request) throws YarnException {
checkAcls("runCleanerTask");
RunSharedCacheCleanerTaskResponse response = recordFactory.newRecordInstance(RunSharedCacheCleanerTaskResponse.class);
this.cleanerService.runCleanerTask();
// if we are here, then we have submitted the request to the cleaner
// service, ack the request to the admin client
response.setAccepted(true);
return response;
}
use of org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse in project hadoop by apache.
the class TestSCMAdminProtocolService method testRunCleanerTask.
@Test
public void testRunCleanerTask() throws Exception {
doNothing().when(cleaner).runCleanerTask();
RunSharedCacheCleanerTaskRequest request = recordFactory.newRecordInstance(RunSharedCacheCleanerTaskRequest.class);
RunSharedCacheCleanerTaskResponse response = SCMAdminProxy.runCleanerTask(request);
Assert.assertTrue("cleaner task request isn't accepted", response.getAccepted());
verify(service, times(1)).runCleanerTask(any(RunSharedCacheCleanerTaskRequest.class));
}
use of org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse in project hadoop by apache.
the class TestSCMAdminProtocolService method testRunCleanerTaskCLI.
@Test
public void testRunCleanerTaskCLI() throws Exception {
String[] args = { "-runCleanerTask" };
RunSharedCacheCleanerTaskResponse rp = new RunSharedCacheCleanerTaskResponsePBImpl();
rp.setAccepted(true);
when(mockAdmin.runCleanerTask(isA(RunSharedCacheCleanerTaskRequest.class))).thenReturn(rp);
assertEquals(0, adminCLI.run(args));
rp.setAccepted(false);
when(mockAdmin.runCleanerTask(isA(RunSharedCacheCleanerTaskRequest.class))).thenReturn(rp);
assertEquals(1, adminCLI.run(args));
verify(mockAdmin, times(2)).runCleanerTask(any(RunSharedCacheCleanerTaskRequest.class));
}
use of org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse in project hadoop by apache.
the class SCMAdmin method runCleanerTask.
private int runCleanerTask() throws YarnException, IOException {
// run cleaner task right away
SCMAdminProtocol scmAdminProtocol = createSCMAdminProtocol();
RunSharedCacheCleanerTaskRequest request = recordFactory.newRecordInstance(RunSharedCacheCleanerTaskRequest.class);
RunSharedCacheCleanerTaskResponse response = scmAdminProtocol.runCleanerTask(request);
if (response.getAccepted()) {
System.out.println("request accepted by shared cache manager");
return 0;
} else {
System.out.println("request rejected by shared cache manager");
return 1;
}
}
Aggregations