本文整理汇总了Java中org.apache.hadoop.mapreduce.security.TokenCache.cleanUpTokenReferral方法的典型用法代码示例。如果您正苦于以下问题:Java TokenCache.cleanUpTokenReferral方法的具体用法?Java TokenCache.cleanUpTokenReferral怎么用?Java TokenCache.cleanUpTokenReferral使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapreduce.security.TokenCache
的用法示例。
在下文中一共展示了TokenCache.cleanUpTokenReferral方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startPSServer
import org.apache.hadoop.mapreduce.security.TokenCache; //导入方法依赖的package包/类
@Override
public void startPSServer() throws AngelException {
try {
setUser();
setLocalAddr();
Path stagingDir = AngelApps.getStagingDir(conf, userName);
// 2.get job id
yarnClient = YarnClient.createYarnClient();
YarnConfiguration yarnConf = new YarnConfiguration(conf);
yarnClient.init(yarnConf);
yarnClient.start();
YarnClientApplication newApp;
newApp = yarnClient.createApplication();
GetNewApplicationResponse newAppResponse = newApp.getNewApplicationResponse();
appId = newAppResponse.getApplicationId();
JobID jobId = TypeConverter.fromYarn(appId);
Path submitJobDir = new Path(stagingDir, appId.toString());
jtFs = submitJobDir.getFileSystem(conf);
conf.set("hadoop.http.filter.initializers",
"org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer");
conf.set(AngelConf.ANGEL_JOB_DIR, submitJobDir.toString());
conf.set(AngelConf.ANGEL_JOB_ID, jobId.toString());
setInputDirectory();
setOutputDirectory();
// Credentials credentials = new Credentials();
credentials.addAll(UserGroupInformation.getCurrentUser().getCredentials());
TokenCache.obtainTokensForNamenodes(credentials, new Path[] {submitJobDir}, conf);
checkParameters(conf);
handleDeprecatedParameters(conf);
// 4.copy resource files to hdfs
copyAndConfigureFiles(conf, submitJobDir, (short) 10);
// 5.write configuration to a xml file
Path submitJobFile = JobSubmissionFiles.getJobConfPath(submitJobDir);
TokenCache.cleanUpTokenReferral(conf);
writeConf(conf, submitJobFile);
// 6.create am container context
ApplicationSubmissionContext appContext =
createApplicationSubmissionContext(conf, submitJobDir, credentials, appId);
conf.set(AngelConf.ANGEL_JOB_LIBJARS, "");
// 7.Submit to ResourceManager
appId = yarnClient.submitApplication(appContext);
// 8.get app master client
updateMaster(10 * 60);
waitForAllPS(conf.getInt(AngelConf.ANGEL_PS_NUMBER, AngelConf.DEFAULT_ANGEL_PS_NUMBER));
LOG.info("start pss success");
} catch (Exception x) {
LOG.error("submit application to yarn failed.", x);
throw new AngelException(x);
}
}