Search in sources :

Example 1 with RunSharedCacheCleanerTaskRequest

use of org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest 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));
}
Also used : RunSharedCacheCleanerTaskResponse(org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse) RunSharedCacheCleanerTaskRequest(org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest) Test(org.junit.Test)

Example 2 with RunSharedCacheCleanerTaskRequest

use of org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest 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;
    }
}
Also used : RunSharedCacheCleanerTaskResponse(org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse) SCMAdminProtocol(org.apache.hadoop.yarn.server.api.SCMAdminProtocol) RunSharedCacheCleanerTaskRequest(org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest)

Aggregations

RunSharedCacheCleanerTaskRequest (org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest)2 RunSharedCacheCleanerTaskResponse (org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse)2 SCMAdminProtocol (org.apache.hadoop.yarn.server.api.SCMAdminProtocol)1 Test (org.junit.Test)1