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


Java IntegerRanges类代码示例

本文整理汇总了Java中org.apache.hadoop.conf.Configuration.IntegerRanges的典型用法代码示例。如果您正苦于以下问题:Java IntegerRanges类的具体用法?Java IntegerRanges怎么用?Java IntegerRanges使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testIntegerRanges

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
public void testIntegerRanges() {
  Configuration conf = new Configuration();
  conf.set("first", "-100");
  conf.set("second", "4-6,9-10,27");
  conf.set("third", "34-");
  Configuration.IntegerRanges range = conf.getRange("first", null);
  System.out.println("first = " + range);
  assertEquals(true, range.isIncluded(0));
  assertEquals(true, range.isIncluded(1));
  assertEquals(true, range.isIncluded(100));
  assertEquals(false, range.isIncluded(101));
  range = conf.getRange("second", null);
  System.out.println("second = " + range);
  assertEquals(false, range.isIncluded(3));
  assertEquals(true, range.isIncluded(4));
  assertEquals(true, range.isIncluded(6));
  assertEquals(false, range.isIncluded(7));
  assertEquals(false, range.isIncluded(8));
  assertEquals(true, range.isIncluded(9));
  assertEquals(true, range.isIncluded(10));
  assertEquals(false, range.isIncluded(11));
  assertEquals(false, range.isIncluded(26));
  assertEquals(true, range.isIncluded(27));
  assertEquals(false, range.isIncluded(28));
  range = conf.getRange("third", null);
  System.out.println("third = " + range);
  assertEquals(false, range.isIncluded(33));
  assertEquals(true, range.isIncluded(34));
  assertEquals(true, range.isIncluded(100000000));
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:31,代码来源:TestConfiguration.java

示例2: printTaskEvents

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
private void printTaskEvents(TaskCompletionEvent[] events,
    Job.TaskStatusFilter filter, boolean profiling, IntegerRanges mapRanges,
    IntegerRanges reduceRanges) throws IOException, InterruptedException {
  for (TaskCompletionEvent event : events) {
    switch (filter) {
    case NONE:
      break;
    case SUCCEEDED:
      if (event.getStatus() == 
        TaskCompletionEvent.Status.SUCCEEDED) {
        LOG.info(event.toString());
      }
      break; 
    case FAILED:
      if (event.getStatus() == 
        TaskCompletionEvent.Status.FAILED) {
        LOG.info(event.toString());
        // Displaying the task diagnostic information
        TaskAttemptID taskId = event.getTaskAttemptId();
        String[] taskDiagnostics = getTaskDiagnostics(taskId); 
        if (taskDiagnostics != null) {
          for (String diagnostics : taskDiagnostics) {
            System.err.println(diagnostics);
          }
        }
      }
      break; 
    case KILLED:
      if (event.getStatus() == TaskCompletionEvent.Status.KILLED){
        LOG.info(event.toString());
      }
      break; 
    case ALL:
      LOG.info(event.toString());
      break;
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:39,代码来源:Job.java

示例3: monitorAndPrintJob

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
/**
 * Monitor a job and print status in real-time as progress is made and tasks 
 * fail.
 * @return true if the job succeeded
 * @throws IOException if communication to the JobTracker fails
 */
public boolean monitorAndPrintJob() 
    throws IOException, InterruptedException {
  String lastReport = null;
  Job.TaskStatusFilter filter;
  Configuration clientConf = cluster.getConf();
  filter = Job.getTaskOutputFilter(clientConf);
  JobID jobId = getJobID();
  LOG.info("Running job: " + jobId);
  int eventCounter = 0;
  boolean profiling = getProfileEnabled();
  IntegerRanges mapRanges = getProfileTaskRange(true);
  IntegerRanges reduceRanges = getProfileTaskRange(false);
  int progMonitorPollIntervalMillis = 
    Job.getProgressPollInterval(clientConf);
  while (!isComplete()) {
    Thread.sleep(progMonitorPollIntervalMillis);
    String report = 
      (" map " + StringUtils.formatPercent(mapProgress(), 0)+
          " reduce " + 
          StringUtils.formatPercent(reduceProgress(), 0));
    if (!report.equals(lastReport)) {
      LOG.info(report);
      lastReport = report;
    }

    TaskCompletionEvent[] events = 
      getTaskCompletionEvents(eventCounter, 10); 
    eventCounter += events.length;
    printTaskEvents(events, filter, profiling, mapRanges, reduceRanges);
  }
  Counters counters = getCounters();
  if (counters != null) {
    LOG.info(counters.toString());
  }
  LOG.info("Job " + jobId + " completed with status: "
        + getStatus().getState());
  return isSuccessful();
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:45,代码来源:Job.java

示例4: getProfileTaskRange

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
@Override public IntegerRanges getProfileTaskRange(boolean arg0) {
  return null;
}
 
开发者ID:Tencent,项目名称:angel,代码行数:4,代码来源:MRTaskContext.java

示例5: monitorAndPrintJob

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
/**
 * Monitor a job and print status in real-time as progress is made and tasks 
 * fail.
 * @return true if the job succeeded
 * @throws IOException if communication to the JobTracker fails
 */
public boolean monitorAndPrintJob() 
    throws IOException, InterruptedException {
  String lastReport = null;
  Job.TaskStatusFilter filter;
  Configuration clientConf = getConfiguration();
  filter = Job.getTaskOutputFilter(clientConf);
  JobID jobId = getJobID();
  LOG.info("Running job: " + jobId);
  int eventCounter = 0;
  boolean profiling = getProfileEnabled();
  IntegerRanges mapRanges = getProfileTaskRange(true);
  IntegerRanges reduceRanges = getProfileTaskRange(false);
  int progMonitorPollIntervalMillis = 
    Job.getProgressPollInterval(clientConf);
  /* make sure to report full progress after the job is done */
  boolean reportedAfterCompletion = false;
  boolean reportedUberMode = false;
  while (!isComplete() || !reportedAfterCompletion) {
    if (isComplete()) {
      reportedAfterCompletion = true;
    } else {
      Thread.sleep(progMonitorPollIntervalMillis);
    }
    if (status.getState() == JobStatus.State.PREP) {
      continue;
    }      
    if (!reportedUberMode) {
      reportedUberMode = true;
      LOG.info("Job " + jobId + " running in uber mode : " + isUber());
    }      
    String report = 
      (" map " + StringUtils.formatPercent(mapProgress(), 0)+
          " reduce " + 
          StringUtils.formatPercent(reduceProgress(), 0));
    if (!report.equals(lastReport)) {
      LOG.info(report);
      lastReport = report;
    }

    TaskCompletionEvent[] events = 
      getTaskCompletionEvents(eventCounter, 10); 
    eventCounter += events.length;
    printTaskEvents(events, filter, profiling, mapRanges, reduceRanges);
  }
  boolean success = isSuccessful();
  if (success) {
    LOG.info("Job " + jobId + " completed successfully");
  } else {
    LOG.info("Job " + jobId + " failed with state " + status.getState() + 
        " due to: " + status.getFailureInfo());
  }
  Counters counters = getCounters();
  if (counters != null) {
    LOG.info(counters.toString());
  }
  return success;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:64,代码来源:Job.java

示例6: getProfileTaskRange

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
@Override
public IntegerRanges getProfileTaskRange(boolean isMap) {
  return mapContext.getProfileTaskRange(isMap);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:WrappedMapper.java

示例7: getProfileTaskRange

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
@Override
public IntegerRanges getProfileTaskRange(boolean isMap) {
  return reduceContext.getProfileTaskRange(isMap);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:WrappedReducer.java

示例8: getProfileTaskRange

import org.apache.hadoop.conf.Configuration.IntegerRanges; //导入依赖的package包/类
@Override
public IntegerRanges getProfileTaskRange(boolean isMap) {
  return base.getProfileTaskRange(isMap);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:5,代码来源:ChainReduceContextImpl.java


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