當前位置: 首頁>>代碼示例>>Java>>正文


Java TokenCache.cleanUpTokenReferral方法代碼示例

本文整理匯總了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);
  }
}
 
開發者ID:Tencent,項目名稱:angel,代碼行數:64,代碼來源:AngelYarnClient.java


注:本文中的org.apache.hadoop.mapreduce.security.TokenCache.cleanUpTokenReferral方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。