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


Java ApplicationAttemptId.toString方法代碼示例

本文整理匯總了Java中org.apache.hadoop.yarn.api.records.ApplicationAttemptId.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationAttemptId.toString方法的具體用法?Java ApplicationAttemptId.toString怎麽用?Java ApplicationAttemptId.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.yarn.api.records.ApplicationAttemptId的用法示例。


在下文中一共展示了ApplicationAttemptId.toString方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateApplicationAttemptStateInternal

import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; //導入方法依賴的package包/類
@Override
public synchronized void updateApplicationAttemptStateInternal(
    ApplicationAttemptId appAttemptId,
    ApplicationAttemptStateData attemptStateDataPB)
    throws Exception {
  String appIdStr = appAttemptId.getApplicationId().toString();
  String appAttemptIdStr = appAttemptId.toString();
  String appDirPath = getNodePath(rmAppRoot, appIdStr);
  String nodeUpdatePath = getNodePath(appDirPath, appAttemptIdStr);
  if (LOG.isDebugEnabled()) {
    LOG.debug("Storing final state info for attempt: " + appAttemptIdStr
        + " at: " + nodeUpdatePath);
  }
  byte[] attemptStateData = attemptStateDataPB.getProto().toByteArray();

  if (existsWithRetries(nodeUpdatePath, false) != null) {
    setDataWithRetries(nodeUpdatePath, attemptStateData, -1);
  } else {
    createWithRetries(nodeUpdatePath, attemptStateData, zkAcl,
      CreateMode.PERSISTENT);
    LOG.debug(appAttemptId + " znode didn't exist. Created a new znode to"
        + " update the application attempt state.");
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:25,代碼來源:ZKRMStateStore.java

示例2: modifyAppState

import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; //導入方法依賴的package包/類
@Override
protected void modifyAppState() throws Exception {
  // imitate appAttemptFile1 is still .new, but old one is deleted
  String appAttemptIdStr1 = "appattempt_1352994193343_0001_000001";
  ApplicationAttemptId attemptId1 =
      ConverterUtils.toApplicationAttemptId(appAttemptIdStr1);
  Path appDir =
          fsTester.store.getAppDir(attemptId1.getApplicationId().toString());
  Path appAttemptFile1 =
      new Path(appDir, attemptId1.toString() + ".new");
  FileSystemRMStateStore fileSystemRMStateStore =
      (FileSystemRMStateStore) fsTester.getRMStateStore();
  fileSystemRMStateStore.renameFile(appAttemptFile1,
          new Path(appAttemptFile1.getParent(),
                  appAttemptFile1.getName() + ".new"));
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:TestFSRMStateStore.java

示例3: initializeDependOnZKStoreConfig

import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; //導入方法依賴的package包/類
public void initializeDependOnZKStoreConfig(ZookeeperStore zkStore) throws Exception {
  // ConverterUtils depends on the JVM inited by ZooKeeperClient
  ApplicationAttemptId attemptId = ConverterUtils.toContainerId(getAmContainerId()).getApplicationAttemptId();
  this.attemptId = attemptId.toString();
  applicationId = attemptId.getApplicationId().toString();

  launcherConfig = zkStore.getLauncherStatus().getLauncherConfiguration();
}
 
開發者ID:Microsoft,項目名稱:pai,代碼行數:9,代碼來源:Configuration.java

示例4: retrievePassword

import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; //導入方法依賴的package包/類
/**
 * This method will be used to verify NMTokens generated by different master
 * keys.
 */
@Override
public synchronized byte[] retrievePassword(NMTokenIdentifier identifier)
    throws InvalidToken {
  int keyId = identifier.getKeyId();
  ApplicationAttemptId appAttemptId = identifier.getApplicationAttemptId();

  /*
   * MasterKey used for retrieving password will be as follows. 1) By default
   * older saved master key will be used. 2) If identifier's master key id
   * matches that of previous master key id then previous key will be used. 3)
   * If identifier's master key id matches that of current master key id then
   * current key will be used.
   */
  MasterKeyData oldMasterKey = oldMasterKeys.get(appAttemptId);
  MasterKeyData masterKeyToUse = oldMasterKey;
  if (previousMasterKey != null
      && keyId == previousMasterKey.getMasterKey().getKeyId()) {
    masterKeyToUse = previousMasterKey;
  } else if (keyId == currentMasterKey.getMasterKey().getKeyId()) {
    masterKeyToUse = currentMasterKey;
  }
  
  if (nodeId != null && !identifier.getNodeId().equals(nodeId)) {
    throw new InvalidToken("Given NMToken for application : "
        + appAttemptId.toString() + " is not valid for current node manager."
        + "expected : " + nodeId.toString() + " found : "
        + identifier.getNodeId().toString());
  }
  
  if (masterKeyToUse != null) {
    byte[] password = retrivePasswordInternal(identifier, masterKeyToUse);
    LOG.debug("NMToken password retrieved successfully!!");
    return password;
  }

  throw new InvalidToken("Given NMToken for application : "
      + appAttemptId.toString() + " seems to have been generated illegally.");
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:43,代碼來源:NMTokenSecretManagerInNM.java

示例5: testFSRMStateStore

import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; //導入方法依賴的package包/類
@Test(timeout = 60000)
public void testFSRMStateStore() throws Exception {
  HdfsConfiguration conf = new HdfsConfiguration();
  MiniDFSCluster cluster =
          new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
  try {
    fsTester = new TestFSRMStateStoreTester(cluster, false);
    // If the state store is FileSystemRMStateStore then add corrupted entry.
    // It should discard the entry and remove it from file system.
    FSDataOutputStream fsOut = null;
    FileSystemRMStateStore fileSystemRMStateStore =
            (FileSystemRMStateStore) fsTester.getRMStateStore();
    String appAttemptIdStr3 = "appattempt_1352994193343_0001_000003";
    ApplicationAttemptId attemptId3 =
            ConverterUtils.toApplicationAttemptId(appAttemptIdStr3);
    Path appDir =
            fsTester.store.getAppDir(attemptId3.getApplicationId().toString());
    Path tempAppAttemptFile =
            new Path(appDir, attemptId3.toString() + ".tmp");
    fsOut = fileSystemRMStateStore.fs.create(tempAppAttemptFile, false);
    fsOut.write("Some random data ".getBytes());
    fsOut.close();

    testRMAppStateStore(fsTester);
    Assert.assertFalse(fsTester.workingDirPathURI
            .getFileSystem(conf).exists(tempAppAttemptFile));
    testRMDTSecretManagerStateStore(fsTester);
    testCheckVersion(fsTester);
    testEpoch(fsTester);
    testAppDeletion(fsTester);
    testDeleteStore(fsTester);
    testAMRMTokenSecretManagerStateStore(fsTester);
  } finally {
    cluster.shutdown();
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:37,代碼來源:TestFSRMStateStore.java

示例6: AMStartedEvent

import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; //導入方法依賴的package包/類
/**
 * Create an event to record the start of an MR AppMaster
 *
 * @param appAttemptId
 *          the application attempt id.
 * @param startTime
 *          the start time of the AM.
 * @param containerId
 *          the containerId of the AM.
 * @param nodeManagerHost
 *          the node on which the AM is running.
 * @param nodeManagerPort
 *          the port on which the AM is running.
 * @param nodeManagerHttpPort
 *          the httpPort for the node running the AM.
 * @param forcedJobStateOnShutDown
 *          the state to force the job into
 */
public AMStartedEvent(ApplicationAttemptId appAttemptId, long startTime,
    ContainerId containerId, String nodeManagerHost, int nodeManagerPort,
    int nodeManagerHttpPort, String forcedJobStateOnShutDown,
    long submitTime) {
  datum.applicationAttemptId = new Utf8(appAttemptId.toString());
  datum.startTime = startTime;
  datum.containerId = new Utf8(containerId.toString());
  datum.nodeManagerHost = new Utf8(nodeManagerHost);
  datum.nodeManagerPort = nodeManagerPort;
  datum.nodeManagerHttpPort = nodeManagerHttpPort;
  this.forcedJobStateOnShutDown = forcedJobStateOnShutDown;
  this.submitTime = submitTime;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:32,代碼來源:AMStartedEvent.java


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