Search in sources :

Example 1 with SCMAdminProtocol

use of org.apache.hadoop.yarn.server.api.SCMAdminProtocol in project hadoop by apache.

the class TestSCMAdminProtocolService method startUp.

@Before
public void startUp() {
    Configuration conf = new Configuration();
    conf.set(YarnConfiguration.SCM_STORE_CLASS, InMemorySCMStore.class.getName());
    cleaner = mock(CleanerService.class);
    service = spy(new SCMAdminProtocolService(cleaner));
    service.init(conf);
    service.start();
    YarnRPC rpc = YarnRPC.create(new Configuration());
    InetSocketAddress scmAddress = conf.getSocketAddr(YarnConfiguration.SCM_ADMIN_ADDRESS, YarnConfiguration.DEFAULT_SCM_ADMIN_ADDRESS, YarnConfiguration.DEFAULT_SCM_ADMIN_PORT);
    SCMAdminProxy = (SCMAdminProtocol) rpc.getProxy(SCMAdminProtocol.class, scmAddress, conf);
    mockAdmin = mock(SCMAdminProtocol.class);
    adminCLI = new SCMAdmin(new Configuration()) {

        @Override
        protected SCMAdminProtocol createSCMAdminProtocol() throws IOException {
            return mockAdmin;
        }
    };
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) InetSocketAddress(java.net.InetSocketAddress) SCMAdminProtocol(org.apache.hadoop.yarn.server.api.SCMAdminProtocol) SCMAdmin(org.apache.hadoop.yarn.client.SCMAdmin) InMemorySCMStore(org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore) YarnRPC(org.apache.hadoop.yarn.ipc.YarnRPC) IOException(java.io.IOException) Before(org.junit.Before)

Example 2 with SCMAdminProtocol

use of org.apache.hadoop.yarn.server.api.SCMAdminProtocol in project hadoop by apache.

the class SCMAdmin method createSCMAdminProtocol.

protected SCMAdminProtocol createSCMAdminProtocol() throws IOException {
    // Get the current configuration
    final YarnConfiguration conf = new YarnConfiguration(getConf());
    // Create the admin client
    final InetSocketAddress addr = conf.getSocketAddr(YarnConfiguration.SCM_ADMIN_ADDRESS, YarnConfiguration.DEFAULT_SCM_ADMIN_ADDRESS, YarnConfiguration.DEFAULT_SCM_ADMIN_PORT);
    final YarnRPC rpc = YarnRPC.create(conf);
    SCMAdminProtocol scmAdminProtocol = (SCMAdminProtocol) rpc.getProxy(SCMAdminProtocol.class, addr, conf);
    return scmAdminProtocol;
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) InetSocketAddress(java.net.InetSocketAddress) SCMAdminProtocol(org.apache.hadoop.yarn.server.api.SCMAdminProtocol) YarnRPC(org.apache.hadoop.yarn.ipc.YarnRPC)

Example 3 with SCMAdminProtocol

use of org.apache.hadoop.yarn.server.api.SCMAdminProtocol 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

SCMAdminProtocol (org.apache.hadoop.yarn.server.api.SCMAdminProtocol)3 InetSocketAddress (java.net.InetSocketAddress)2 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)2 YarnRPC (org.apache.hadoop.yarn.ipc.YarnRPC)2 IOException (java.io.IOException)1 Configuration (org.apache.hadoop.conf.Configuration)1 SCMAdmin (org.apache.hadoop.yarn.client.SCMAdmin)1 RunSharedCacheCleanerTaskRequest (org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskRequest)1 RunSharedCacheCleanerTaskResponse (org.apache.hadoop.yarn.server.api.protocolrecords.RunSharedCacheCleanerTaskResponse)1 InMemorySCMStore (org.apache.hadoop.yarn.server.sharedcachemanager.store.InMemorySCMStore)1 Before (org.junit.Before)1