当前位置: 首页>>代码示例>>Java>>正文


Java TokenCache.JOB_TOKEN_HDFS_FILE属性代码示例

本文整理汇总了Java中org.apache.hadoop.mapreduce.security.TokenCache.JOB_TOKEN_HDFS_FILE属性的典型用法代码示例。如果您正苦于以下问题:Java TokenCache.JOB_TOKEN_HDFS_FILE属性的具体用法?Java TokenCache.JOB_TOKEN_HDFS_FILE怎么用?Java TokenCache.JOB_TOKEN_HDFS_FILE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.mapreduce.security.TokenCache的用法示例。


在下文中一共展示了TokenCache.JOB_TOKEN_HDFS_FILE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: localizeJobTokenFile

/**
   * Download the job-token file from the FS and save on local fs.
   * @param user
   * @param jobId
   * @return the local file system path of the downloaded file.
   * @throws IOException
   */
private String localizeJobTokenFile(String user, JobID jobId)
      throws IOException {
    // check if the tokenJob file is there..
    Path skPath = new Path(systemDirectory, 
        jobId.toString()+"/"+TokenCache.JOB_TOKEN_HDFS_FILE);
    
    FileStatus status = null;
    long jobTokenSize = -1;
    status = systemFS.getFileStatus(skPath); //throws FileNotFoundException
    jobTokenSize = status.getLen();
    
    Path localJobTokenFile =
        lDirAlloc.getLocalPathForWrite(getPrivateDirJobTokenFile(user, 
            jobId.toString()), jobTokenSize, fConf);
  
    String localJobTokenFileStr = localJobTokenFile.toUri().getPath();
    if(LOG.isDebugEnabled())
      LOG.debug("localizingJobTokenFile from sd="+skPath.toUri().getPath() + 
          " to " + localJobTokenFileStr);
    
    // Download job_token
    systemFS.copyToLocalFile(skPath, localJobTokenFile);      
    return localJobTokenFileStr;
  }
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:31,代码来源:TaskTracker.java

示例2: generateAndStoreTokens

/**
 * generate job token and save it into the file
 * @throws IOException
 */
private void generateAndStoreTokens() throws IOException {
  Path jobDir = jobtracker.getSystemDirectoryForJob(jobId);
  Path keysFile = new Path(jobDir, TokenCache.JOB_TOKEN_HDFS_FILE);
  if (tokenStorage == null) {
    tokenStorage = new Credentials();
  }
  //create JobToken file and write token to it
  JobTokenIdentifier identifier = new JobTokenIdentifier(new Text(jobId
      .toString()));
  Token<JobTokenIdentifier> token = new Token<JobTokenIdentifier>(identifier,
      jobtracker.getJobTokenSecretManager());
  token.setService(identifier.getJobId());
  
  TokenCache.setJobToken(token, tokenStorage);
      
  // write TokenStorage out
  tokenStorage.writeTokenStorageFile(keysFile, jobtracker.getConf());
  LOG.info("jobToken generated and stored with users keys in "
      + keysFile.toUri().getPath());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:24,代码来源:JobInProgress.java

示例3: generateAndStoreTokens

/**
 * generate job token and save it into the file
 * @throws IOException
 */
private void generateAndStoreTokens() throws IOException{
  Path jobDir = jobtracker.getSystemDirectoryForJob(jobId);
  Path keysFile = new Path(jobDir, TokenCache.JOB_TOKEN_HDFS_FILE);

  if (tokenStorage == null) {
    tokenStorage = new Credentials();
  }
  
  //create JobToken file and write token to it
  JobTokenIdentifier identifier = new JobTokenIdentifier(new Text(jobId
      .toString()));
  Token<JobTokenIdentifier> token = new Token<JobTokenIdentifier>(identifier,
      jobtracker.getJobTokenSecretManager());
  token.setService(identifier.getJobId());
  
  TokenCache.setJobToken(token, tokenStorage);
  
  // write TokenStorage out
  tokenStorage.writeTokenStorageFile(keysFile, jobtracker.getConf());
  LOG.info("jobToken generated and stored with users keys in "
      + keysFile.toUri().getPath());
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:26,代码来源:JobInProgress.java

示例4: localizeJobTokenFile

/**
 * Download the job-token file from the FS and save on local fs.
 * @param user
 * @param jobId
 * @param jobConf
 * @return the local file system path of the downloaded file.
 * @throws IOException
 */
private String localizeJobTokenFile(String user, JobID jobId)
    throws IOException {
  // check if the tokenJob file is there..
  Path skPath = new Path(systemDirectory, 
      jobId.toString()+"/"+TokenCache.JOB_TOKEN_HDFS_FILE);
  
  FileStatus status = null;
  long jobTokenSize = -1;
  status = systemFS.getFileStatus(skPath); //throws FileNotFoundException
  jobTokenSize = status.getLen();
  
  Path localJobTokenFile =
      lDirAlloc.getLocalPathForWrite(getLocalJobTokenFile(user, 
          jobId.toString()), jobTokenSize, fConf);
  String localJobTokenFileStr = localJobTokenFile.toUri().getPath();
  LOG.debug("localizingJobTokenFile from sd="+skPath.toUri().getPath() + 
      " to " + localJobTokenFileStr);
  
  // Download job_token
  systemFS.copyToLocalFile(skPath, localJobTokenFile);      
  return localJobTokenFileStr;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:30,代码来源:TaskTracker.java

示例5: generateAndStoreTokens

/**
 * generate job token and save it into the file
 * @throws IOException
 */
private void generateAndStoreTokens() throws IOException {
  Path jobDir = jobtracker.getSystemDirectoryForJob(jobId);
  Path keysFile = new Path(jobDir, TokenCache.JOB_TOKEN_HDFS_FILE);
  if (tokenStorage == null) {
    tokenStorage = new Credentials();
  }
  //create JobToken file and write token to it
  JobTokenIdentifier identifier = new JobTokenIdentifier(new Text(jobId
      .toString()));
  Token<JobTokenIdentifier> token = new Token<JobTokenIdentifier>(identifier,
      jobtracker.getJobTokenSecretManager());
  token.setService(identifier.getJobId());
  
  TokenCache.setJobToken(token, tokenStorage);
      
  // write TokenStorage out
  FileSystem fs = keysFile.getFileSystem(jobtracker.getConf());
  FSDataOutputStream os = null;
  try {
    os = fs.createNonRecursive(keysFile, true,
        jobtracker.getConf().getInt("io.file.buffer.size", 4096),
        fs.getDefaultReplication(keysFile),
        fs.getDefaultBlockSize(keysFile), null);
    tokenStorage.writeTokenStorageToStream(os);
  } finally {
    IOUtils.closeStream(os);
  }
  LOG.info("jobToken generated and stored with users keys in "
      + keysFile.toUri().getPath());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:34,代码来源:JobInProgress.java


注:本文中的org.apache.hadoop.mapreduce.security.TokenCache.JOB_TOKEN_HDFS_FILE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。