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


Java JobID.downgrade方法代碼示例

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


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

示例1: getAssignedJobID

import org.apache.hadoop.mapred.JobID; //導入方法依賴的package包/類
/**
 * @return the mapred ID of this job as assigned by the mapred framework.
 */
public JobID getAssignedJobID() {
  org.apache.hadoop.mapreduce.JobID temp = super.getMapredJobId();
  if (temp == null) {
    return null;
  }
  return JobID.downgrade(temp);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:11,代碼來源:Job.java

示例2: getAssignedJobID

import org.apache.hadoop.mapred.JobID; //導入方法依賴的package包/類
/**
 * @return the mapred ID of this job as assigned by the 
 * mapred framework.
 */
public JobID getAssignedJobID() {
  org.apache.hadoop.mapreduce.JobID temp = super.getMapredJobID();
  if(temp == null) {
    return null;
  }
  return JobID.downgrade(temp);
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:12,代碼來源:Job.java

示例3: testRecovery

import org.apache.hadoop.mapred.JobID; //導入方法依賴的package包/類
@Test
public void testRecovery() throws IOException {
  final String user = "someuser";
  final ApplicationId appId = ApplicationId.newInstance(12345, 1);
  final JobID jobId = JobID.downgrade(TypeConverter.fromYarn(appId));
  final File tmpDir = new File(System.getProperty("test.build.data",
      System.getProperty("java.io.tmpdir")),
      TestShuffleHandler.class.getName());
  Configuration conf = new Configuration();
  conf.setInt(ShuffleHandler.SHUFFLE_PORT_CONFIG_KEY, 0);
  conf.setInt(ShuffleHandler.MAX_SHUFFLE_CONNECTIONS, 3);
  ShuffleHandler shuffle = new ShuffleHandler();
  // emulate aux services startup with recovery enabled
  shuffle.setRecoveryPath(new Path(tmpDir.toString()));
  tmpDir.mkdirs();
  try {
    shuffle.init(conf);
    shuffle.start();

    // setup a shuffle token for an application
    DataOutputBuffer outputBuffer = new DataOutputBuffer();
    outputBuffer.reset();
    Token<JobTokenIdentifier> jt = new Token<JobTokenIdentifier>(
        "identifier".getBytes(), "password".getBytes(), new Text(user),
        new Text("shuffleService"));
    jt.write(outputBuffer);
    shuffle.initializeApplication(new ApplicationInitializationContext(user,
        appId, ByteBuffer.wrap(outputBuffer.getData(), 0,
          outputBuffer.getLength())));

    // verify we are authorized to shuffle
    int rc = getShuffleResponseCode(shuffle, jt);
    Assert.assertEquals(HttpURLConnection.HTTP_OK, rc);

    // emulate shuffle handler restart
    shuffle.close();
    shuffle = new ShuffleHandler();
    shuffle.setRecoveryPath(new Path(tmpDir.toString()));
    shuffle.init(conf);
    shuffle.start();

    // verify we are still authorized to shuffle to the old application
    rc = getShuffleResponseCode(shuffle, jt);
    Assert.assertEquals(HttpURLConnection.HTTP_OK, rc);

    // shutdown app and verify access is lost
    shuffle.stopApplication(new ApplicationTerminationContext(appId));
    rc = getShuffleResponseCode(shuffle, jt);
    Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, rc);

    // emulate shuffle handler restart
    shuffle.close();
    shuffle = new ShuffleHandler();
    shuffle.setRecoveryPath(new Path(tmpDir.toString()));
    shuffle.init(conf);
    shuffle.start();

    // verify we still don't have access
    rc = getShuffleResponseCode(shuffle, jt);
    Assert.assertEquals(HttpURLConnection.HTTP_UNAUTHORIZED, rc);
  } finally {
    if (shuffle != null) {
      shuffle.close();
    }
    FileUtil.fullyDelete(tmpDir);
  }
}
 
開發者ID:apache,項目名稱:tez,代碼行數:68,代碼來源:TestShuffleHandler.java


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