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;
}
};
}
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;
}
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;
}
}
Aggregations