本文整理了Java中org.apache.hadoop.yarn.ipc.YarnRPC.create()
方法的一些代码示例,展示了YarnRPC.create()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnRPC.create()
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.ipc.YarnRPC
类名称:YarnRPC
方法名:create
暂无
代码示例来源:origin: apache/incubator-gobblin
private static void getJhToken(Configuration conf, Credentials cred) throws IOException {
YarnRPC rpc = YarnRPC.create(conf);
final String serviceAddr = conf.get(JHAdminConfig.MR_HISTORY_ADDRESS);
LOG.debug("Connecting to HistoryServer at: " + serviceAddr);
HSClientProtocol hsProxy =
(HSClientProtocol) rpc.getProxy(HSClientProtocol.class, NetUtils.createSocketAddr(serviceAddr), conf);
LOG.info("Pre-fetching JH token from job history server");
Token<?> jhToken = null;
try {
jhToken = getDelegationTokenFromHS(hsProxy, conf);
} catch (Exception exc) {
throw new IOException("Failed to fetch JH token.", exc);
}
if (jhToken == null) {
LOG.error("getDelegationTokenFromHS() returned null");
throw new IOException("Unable to fetch JH token.");
}
LOG.info("Created JH token: " + jhToken.toString());
LOG.info("Token kind: " + jhToken.getKind());
LOG.info("Token id: " + Arrays.toString(jhToken.getIdentifier()));
LOG.info("Token service: " + jhToken.getService());
cred.addToken(jhToken.getService(), jhToken);
}
代码示例来源:origin: Qihoo360/XLearning
protected void serviceStart() throws Exception {
Configuration conf = new XLearningConfiguration();
YarnRPC rpc = YarnRPC.create(conf);
initializeWebApp(conf);
InetSocketAddress address = conf.getSocketAddr(
XLearningConfiguration.XLEARNING_HISTORY_BIND_HOST,
XLearningConfiguration.XLEARNING_HISTORY_ADDRESS,
conf.get(XLearningConfiguration.XLEARNING_HISTORY_ADDRESS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_ADDRESS),
conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_PORT, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_PORT));
server =
rpc.getServer(HSClientProtocol.class, protocolHandler, address,
conf, jhsDTSecretManager,
conf.getInt(XLearningConfiguration.XLEARNING_HISTORY_CLIENT_THREAD_COUNT,
XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_CLIENT_THREAD_COUNT));
// Enable service authorization?
if (conf.getBoolean(
CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHORIZATION,
false)) {
server.refreshServiceAcl(conf, new ClientHSPolicyProvider());
}
server.start();
this.bindAddress = conf.updateConnectAddr(XLearningConfiguration.XLEARNING_HISTORY_BIND_HOST,
XLearningConfiguration.XLEARNING_HISTORY_ADDRESS,
conf.get(XLearningConfiguration.XLEARNING_HISTORY_ADDRESS, XLearningConfiguration.DEFAULT_XLEARNING_HISTORY_ADDRESS),
server.getListenerAddress());
LOG.info("Instantiated HistoryClientService at " + this.bindAddress);
super.serviceStart();
}
代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-jobclient
MRClientProtocol instantiateAMProxy(final InetSocketAddress serviceAddr)
throws IOException {
LOG.trace("Connecting to ApplicationMaster at: " + serviceAddr);
YarnRPC rpc = YarnRPC.create(conf);
MRClientProtocol proxy =
(MRClientProtocol) rpc.getProxy(MRClientProtocol.class,
serviceAddr, conf);
usingAMProxy.set(true);
LOG.trace("Connected to ApplicationMaster at: " + serviceAddr);
return proxy;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
@Override
public T run() {
return (T) YarnRPC.create(conf).getProxy(protocol, rmAddress, conf);
}
});
代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-jobclient
MRClientProtocol instantiateAMProxy(final InetSocketAddress serviceAddr)
throws IOException {
LOG.trace("Connecting to ApplicationMaster at: " + serviceAddr);
YarnRPC rpc = YarnRPC.create(conf);
MRClientProtocol proxy =
(MRClientProtocol) rpc.getProxy(MRClientProtocol.class,
serviceAddr, conf);
usingAMProxy.set(true);
LOG.trace("Connected to ApplicationMaster at: " + serviceAddr);
return proxy;
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-common
@Override
public T run() {
return (T) YarnRPC.create(conf).getProxy(protocol, rmAddress, conf);
}
});
代码示例来源:origin: alibaba/mpich2-yarn
/**
* Constructor, connect to Resource Manager
*
* @throws IOException
*/
public ApplicationMaster() throws IOException {
super(ApplicationMaster.class.getName());
// Set up the configuration and RPC
conf = new MPIConfiguration();
rpc = YarnRPC.create(conf);
dfs = FileSystem.get(conf);
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-nodemanager
LocalizationProtocol getProxy(final InetSocketAddress nmAddr) {
YarnRPC rpc = YarnRPC.create(conf);
return (LocalizationProtocol)
rpc.getProxy(LocalizationProtocol.class, nmAddr, conf);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-common
@Override
public T run() {
return (T) YarnRPC.create(conf).getProxy(protocol, rmAddress, conf);
}
});
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
@Private
@VisibleForTesting
public LocalizationProtocol getProxy(final InetSocketAddress nmAddr) {
YarnRPC rpc = YarnRPC.create(conf);
return (LocalizationProtocol)
rpc.getProxy(LocalizationProtocol.class, nmAddr, conf);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-nodemanager
private SCMUploaderProtocol createSCMClient(Configuration conf) {
YarnRPC rpc = YarnRPC.create(conf);
InetSocketAddress scmAddress =
conf.getSocketAddr(YarnConfiguration.SCM_UPLOADER_SERVER_ADDRESS,
YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_ADDRESS,
YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_PORT);
return (SCMUploaderProtocol)rpc.getProxy(
SCMUploaderProtocol.class, scmAddress, conf);
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-nodemanager
private SCMUploaderProtocol createSCMClient(Configuration conf) {
YarnRPC rpc = YarnRPC.create(conf);
InetSocketAddress scmAddress =
conf.getSocketAddr(YarnConfiguration.SCM_UPLOADER_SERVER_ADDRESS,
YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_ADDRESS,
YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_PORT);
return (SCMUploaderProtocol)rpc.getProxy(
SCMUploaderProtocol.class, scmAddress, conf);
}
代码示例来源:origin: io.hops/hadoop-yarn-server-nodemanager
private SCMUploaderProtocol createSCMClient(Configuration conf) {
YarnRPC rpc = YarnRPC.create(conf);
InetSocketAddress scmAddress =
conf.getSocketAddr(YarnConfiguration.SCM_UPLOADER_SERVER_ADDRESS,
YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_ADDRESS,
YarnConfiguration.DEFAULT_SCM_UPLOADER_SERVER_PORT);
return (SCMUploaderProtocol)rpc.getProxy(
SCMUploaderProtocol.class, scmAddress, conf);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-client
@VisibleForTesting
protected ClientSCMProtocol createClientProxy() {
YarnRPC rpc = YarnRPC.create(getConfig());
return (ClientSCMProtocol) rpc.getProxy(ClientSCMProtocol.class,
this.scmAddress, getConfig());
}
代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-client
@VisibleForTesting
protected ClientSCMProtocol createClientProxy() {
YarnRPC rpc = YarnRPC.create(getConfig());
return (ClientSCMProtocol) rpc.getProxy(ClientSCMProtocol.class,
this.scmAddress, getConfig());
}
代码示例来源:origin: io.hops/hadoop-yarn-client
@VisibleForTesting
protected ClientSCMProtocol createClientProxy() {
YarnRPC rpc = YarnRPC.create(getConfig());
return (ClientSCMProtocol) rpc.getProxy(ClientSCMProtocol.class,
this.scmAddress, getConfig());
}
代码示例来源:origin: apache/hama
public YARNBSPJob(HamaConfiguration conf) throws IOException {
submitClient = new YARNBSPJobClient(conf);
YarnConfiguration yarnConf = new YarnConfiguration(conf);
this.rpc = YarnRPC.create(conf);
InetSocketAddress rmAddress = NetUtils.createSocketAddr(yarnConf.get(
YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS));
LOG.info("Connecting to ResourceManager at " + rmAddress);
this.applicationsManager = ((ApplicationClientProtocol) rpc.getProxy(
ApplicationClientProtocol.class, rmAddress, conf));
}
代码示例来源:origin: org.apache.twill/twill-yarn
public Hadoop20YarnAMClient(Configuration conf) {
super(ApplicationConstants.AM_CONTAINER_ID_ENV);
this.amrmClient = new AMRMClientImpl(containerId.getApplicationAttemptId());
this.amrmClient.init(conf);
this.nmClient = new Hadoop20YarnNMClient(YarnRPC.create(conf), conf);
}
代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-app
@Override
public MRClientProtocol run() throws Exception {
YarnRPC rpc = YarnRPC.create(conf);
return (MRClientProtocol) rpc.getProxy(MRClientProtocol.class,
app.clientService.getBindAddress(), conf);
}
});
代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient
private HSClientProtocol instantiateHistoryProxy() {
final String serviceAddr =
mrCluster.getConfig().get(JHAdminConfig.MR_HISTORY_ADDRESS);
final YarnRPC rpc = YarnRPC.create(conf);
HSClientProtocol historyClient =
(HSClientProtocol) rpc.getProxy(HSClientProtocol.class,
NetUtils.createSocketAddr(serviceAddr), mrCluster.getConfig());
return historyClient;
}
}
内容来源于网络,如有侵权,请联系作者删除!