gpt4 book ai didi

org.apache.hadoop.yarn.api.records.YarnApplicationState类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 16:28:40 35 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.yarn.api.records.YarnApplicationState类的一些代码示例,展示了YarnApplicationState类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnApplicationState类的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.YarnApplicationState
类名称:YarnApplicationState

YarnApplicationState介绍

[英]Enumeration of various states of an ApplicationMaster.
[中]ApplicationMaster的各种状态的枚举。

代码示例

代码示例来源:origin: alibaba/jstorm

writename.createNewFile();
BufferedWriter out = new BufferedWriter(new FileWriter(writename));
out.write(report.getHost() + JOYConstants.NEW_LINE);
out.write(report.getRpcPort() + JOYConstants.NEW_LINE);
out.flush();
out.close();
  + ", clientToAMToken=" + report.getClientToAMToken()
  + ", appDiagnostics=" + report.getDiagnostics()
  + ", appMasterHost=" + report.getHost()
  + ", appMasterRpcPort=" + report.getRpcPort()
  + ", appStartTime=" + report.getStartTime()
  + ", yarnAppState=" + report.getYarnApplicationState().toString()
  + ", distributedFinalState=" + report.getFinalApplicationStatus().toString()
  + ", appTrackingUrl=" + report.getTrackingUrl()
} else {
  LOG.info("Application did finished unsuccessfully."
      + " YarnState=" + state.toString() + ", DSFinalStatus=" + dsStatus.toString()
      + ". Breaking monitoring loop");
  return false;
  || YarnApplicationState.FAILED == state) {
LOG.info("Application did not finish."
    + " YarnState=" + state.toString() + ", DSFinalStatus=" + dsStatus.toString()
    + ". Breaking monitoring loop");
return false;

代码示例来源:origin: uber/AthenaX

static StateView computeState(Map<UUID, JobDefinition> jobs, Map<UUID, InstanceInfo> instances) {
 // Instance ID -> JobDefinition ID
 HashMap<UUID, UUID> instanceToJob = new HashMap<>();
 HashMap<UUID, List<InstanceInfo>> jobInstances = new HashMap<>();
 for (Map.Entry<UUID, InstanceInfo> e : instances.entrySet()) {
  YarnApplicationState state = YarnApplicationState.valueOf(e.getValue().status().getState().toString());
  if (!isInstanceAlive(state)) {
   continue;
  }
  UUID jobId = e.getValue().metadata().jobDefinition();
  UUID instanceId = e.getKey();
  instanceToJob.put(instanceId, jobId);
  if (!jobInstances.containsKey(jobId)) {
   jobInstances.put(jobId, new ArrayList<>());
  }
  jobInstances.get(jobId).add(e.getValue());
 }
 jobs.keySet().stream().filter(x -> !jobInstances.containsKey(x))
   .forEach(x -> jobInstances.put(x, Collections.emptyList()));
 return new StateView(jobs, instances, instanceToJob, jobInstances);
}

代码示例来源:origin: org.apache.slider/slider-core

public SerializedApplicationReport(ApplicationReport report) {
 this.applicationId = report.getApplicationId().toString();
 ApplicationAttemptId attemptId = report.getCurrentApplicationAttemptId();
 this.applicationAttemptId = attemptId != null ? attemptId.toString() : "N/A";
 this.name = report.getName();
 this.applicationType = report.getApplicationType();
 this.user = report.getUser();
 this.queue = report.getQueue();
 this.host = report.getHost();
 this.rpcPort = report.getRpcPort();
 this.state = report.getYarnApplicationState().toString();
 this.diagnostics = report.getDiagnostics();
 this.startTime = report.getStartTime();
 this.finishTime = report.getFinishTime();
 FinalApplicationStatus appStatus = report.getFinalApplicationStatus();
 this.finalStatus = appStatus == null ? "" : appStatus.toString();
 this.progress = report.getProgress();
 this.url = report.getTrackingUrl();
 this.origTrackingUrl= report.getOriginalTrackingUrl();
}

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-client

new OutputStreamWriter(sysout, Charset.forName("UTF-8")));
if (allAppStates) {
 for (YarnApplicationState appState : YarnApplicationState.values()) {
  appStates.add(appState);
for (ApplicationReport appReport : appsReport) {
 DecimalFormat formatter = new DecimalFormat("###.##%");
 String progress = formatter.format(appReport.getProgress());
 writer.printf(APPLICATIONS_PATTERN, appReport.getApplicationId(),
   appReport.getName(), appReport.getApplicationType(), appReport
     .getUser(), appReport.getQueue(), appReport
     .getYarnApplicationState(),

代码示例来源:origin: org.apache.apex/apex-engine

jsonObj.put("startTime", sdf.format(new java.util.Date(ar.getStartTime())));
jsonObj.put("id", ar.getApplicationId().getId());
jsonObj.put("name", ar.getName());
jsonObj.put("state", ar.getYarnApplicationState().name());
jsonObj.put("trackingUrl", ar.getTrackingUrl());
jsonObj.put("finalStatus", ar.getFinalApplicationStatus());

代码示例来源:origin: org.springframework.data/spring-yarn-core

for (SubmittedField f : fields) {
  if (SubmittedField.ID == f) {
    row.addValue(index++, report.getApplicationId().toString());
  } else if (SubmittedField.USER == f) {
    row.addValue(index++, report.getUser());
  } else if (SubmittedField.NAME == f) {
    row.addValue(index++, report.getName());
  } else if (SubmittedField.QUEUE == f) {
    row.addValue(index++, report.getQueue());
    row.addValue(index++, value);
  } else if (SubmittedField.STATE == f) {
    row.addValue(index++, report.getYarnApplicationState().toString());
  } else if (SubmittedField.FINALSTATUS == f) {
    row.addValue(index++, report.getFinalApplicationStatus().toString());

代码示例来源:origin: apache/drill

public void display(boolean verbose, boolean isNew) {
 YarnApplicationState state = report.getYarnApplicationState();
 if (verbose || !isNew) {
  System.out.println("Application State: " + state.toString());
  System.out.println("Host: " + report.getHost());
 }
 if (verbose || !isNew) {
  System.out.println("Queue: " + report.getQueue());
  System.out.println("User: " + report.getUser());
  long startTime = report.getStartTime();
  System.out.println("Start Time: " + DoYUtil.toIsoTime(startTime));
  System.out.println("Application Name: " + report.getName());
 }
 System.out.println("Tracking URL: " + report.getTrackingUrl());
 if (isNew) {
  System.out.println("Application Master URL: " + getAmUrl());
 }
 showFinalStatus();
}

代码示例来源:origin: hopshadoop/hopsworks

private void fetchJobs(List<YarnApplicationReport> reports) {
 if (yarnClientWrapper == null) {
  conf = settings.getConfiguration();
  yarnClientWrapper = ycs.getYarnClientSuper(conf);
 }
 try {
  //Create our custom YarnApplicationReport Pojo
  for (ApplicationReport appReport : yarnClientWrapper.getYarnClient()
    .getApplications()) {
   reports.add(new YarnApplicationReport(appReport.getApplicationId().
       toString(),
       appReport.getName(), appReport.getUser(), appReport.
       getStartTime(), appReport.getFinishTime(), appReport.
       getApplicationId().getClusterTimestamp(),
       appReport.getApplicationId().getId(), appReport.
       getYarnApplicationState().name()));
  }
 } catch (YarnException | IOException ex) {
  logger.log(Level.SEVERE, null, ex);
 }
}

代码示例来源:origin: org.apache.slider/slider-core

instances.size(), appname, desiredState);
for (ApplicationReport app : instances) {
 if (app.getName().equals(appname)) {
    app.getYarnApplicationState();
  log.debug("app ID {} is in state {}", app.getApplicationId(), appstate);
  if (appstate.equals(desiredState)) {
   log.debug("match");
   return app;

代码示例来源:origin: org.springframework.data/spring-yarn-core

row.addValue(1, a.getApplicationId().toString())
    .addValue(2, a.getUser())
    .addValue(3, a.getName())
    .addValue(4, a.getQueue())
    .addValue(5, DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(
    .addValue(6, DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(
        new Date(a.getFinishTime())))
    .addValue(7, a.getYarnApplicationState().toString())
    .addValue(8, a.getFinalApplicationStatus().toString());
table.getRows().add(row);

代码示例来源:origin: Qihoo360/XLearning

private boolean waitCompleted() throws IOException, YarnException {
 ApplicationReport applicationReport = getApplicationReport(applicationId, yarnClient);
 LOG.info("The url to track the job: " + applicationReport.getTrackingUrl());
 while (true) {
  assert (applicationReport != null);
  if (xlearningClient == null && isRunning.get()) {
   LOG.info("Application report for " + applicationId +
     " (state: " + applicationReport.getYarnApplicationState().toString() + ")");
   xlearningClient = getAppMessageHandler(conf, applicationReport.getHost(),
     applicationReport.getRpcPort());
    return true;
   } else {
    LOG.info("Application has completed failed with YarnApplicationState=" + yarnApplicationState.toString() +
      " and FinalApplicationStatus=" + finalApplicationStatus.toString());
    return false;
   xlearningClient = null;
   isRunning.set(false);
   LOG.info("Application has completed with YarnApplicationState=" + yarnApplicationState.toString() +
     " and FinalApplicationStatus=" + finalApplicationStatus.toString());
   return false;

代码示例来源:origin: org.springframework.cloud/spring-cloud-deployer-yarn

public Collection<CloudAppInstanceInfo> getSubmittedApplications() {
  List<CloudAppInstanceInfo> appIds = new ArrayList<CloudAppInstanceInfo>();
  for (ApplicationReport report : yarnClient.listApplications("DATAFLOW")) {
    appIds.add(new CloudAppInstanceInfo(report.getApplicationId().toString(), report.getName(),
        report.getYarnApplicationState().toString(), report.getOriginalTrackingUrl()));
  }
  return appIds;
}

代码示例来源:origin: apache/incubator-gobblin

@Subscribe
public void handleApplicationReportArrivalEvent(ApplicationReportArrivalEvent applicationReportArrivalEvent) {
 ApplicationReport applicationReport = applicationReportArrivalEvent.getApplicationReport();
 YarnApplicationState appState = applicationReport.getYarnApplicationState();
 LOGGER.info("Gobblin Yarn application state: " + appState.toString());
 // Reset the count on failures to get the ApplicationReport when there's one success
 this.getApplicationReportFailureCount.set(0);
 if (appState == YarnApplicationState.FINISHED ||
   appState == YarnApplicationState.FAILED ||
   appState == YarnApplicationState.KILLED) {
  applicationCompleted = true;
  LOGGER.info("Gobblin Yarn application finished with final status: " +
    applicationReport.getFinalApplicationStatus().toString());
  if (applicationReport.getFinalApplicationStatus() == FinalApplicationStatus.FAILED) {
   LOGGER.error("Gobblin Yarn application failed for the following reason: " + applicationReport.getDiagnostics());
  }
  try {
   GobblinYarnAppLauncher.this.stop();
  } catch (IOException ioe) {
   LOGGER.error("Failed to close the " + GobblinYarnAppLauncher.class.getSimpleName(), ioe);
  } catch (TimeoutException te) {
   LOGGER.error("Timeout in stopping the service manager", te);
  } finally {
   if (this.emailNotificationOnShutdown) {
    sendEmailOnShutdown(Optional.of(applicationReport));
   }
  }
 }
}

代码示例来源:origin: uber/AthenaX

static InstanceInfo extractInstanceInfo(String clusterName, ApplicationReport report) {
  InstanceMetadata md = getMetadata(report.getApplicationTags());
  if (md == null) {
   return null;
  }

  ApplicationResourceUsageReport usage = report.getApplicationResourceUsageReport();
  InstanceStatus stat = new InstanceStatus()
    .allocatedVCores((long) usage.getUsedResources().getVirtualCores())
    .allocatedMB((long) usage.getUsedResources().getMemory())
    .clusterId(clusterName)
    .applicationId(report.getApplicationId().toString())
    .startedTime(report.getStartTime())
    .runningContainers((long) usage.getNumUsedContainers())
    .trackingUrl(report.getTrackingUrl())
    .state(InstanceStatus.StateEnum.fromValue(report.getYarnApplicationState().toString()));
  return new InstanceInfo(clusterName, report.getApplicationId(), md, stat);
 }
}

代码示例来源:origin: ml.shifu/guagua-yarn

/**
 * Display a formatted summary of the job progress report from the AM.
 * 
 * @param report
 *            the report to display.
 */
private void displayJobReport(final ApplicationReport report) {
  if(null == report) {
    throw new IllegalStateException(String.format(
        "[*] Latest ApplicationReport for job %s was not received by the local client.", getAppName()));
  }
  final float elapsed = (System.currentTimeMillis() - report.getStartTime()) / 1000.0f;
  LOG.info("{}, Elapsed: {}", getAppName(), String.format("%.2f secs", elapsed));
  LOG.info("{}, State: {} , Containers: used/reserved/needed-resources {}/{}/{}", report
      .getCurrentApplicationAttemptId(), report.getYarnApplicationState().name(), report
      .getApplicationResourceUsageReport().getNumUsedContainers(), report.getApplicationResourceUsageReport()
      .getNumReservedContainers(), report.getApplicationResourceUsageReport().getNeededResources());
}

代码示例来源:origin: org.apache.slider/slider-core

throws IOException, YarnException, InterruptedException {
ApplicationId appId;
appId = application.getApplicationId();
Duration timeout = new Duration(connectTimeout);
timeout.start();
try {
 while (application != null &&
     (state = application.getYarnApplicationState()).equals(
       YarnApplicationState.RUNNING)) {

代码示例来源:origin: harbby/sylph

/**
 * 获取yarn Job运行情况
 */
private boolean isRunning()
{
  try {
    ApplicationReport app = yarnClient.getApplicationReport(getYarnAppId()); //获取某个指定的任务
    YarnApplicationState state = app.getYarnApplicationState();
    return YarnApplicationState.ACCEPTED.equals(state) || YarnApplicationState.RUNNING.equals(state);
  }
  catch (ApplicationNotFoundException e) {  //app 不存在与yarn上面
    return false;
  }
  catch (YarnException | IOException e) {
    throw new SylphException(CONNECTION_ERROR, e);
  }
}

代码示例来源:origin: yahoo/storm-yarn

YarnApplicationState state = report.getYarnApplicationState();
FinalApplicationStatus dsStatus = report.getFinalApplicationStatus();
if (YarnApplicationState.FINISHED == state) {
  if (FinalApplicationStatus.SUCCEEDED == dsStatus) {
  } else {
    LOG.info("Application did finished unsuccessfully."
        + " YarnState=" + state.toString() + ", DSFinalStatus=" + dsStatus.toString()
        + ". Breaking monitoring loop");
    return false;
    || YarnApplicationState.FAILED == state) {
  LOG.info("Application did not finish."
      + " YarnState=" + state.toString() + ", DSFinalStatus=" + dsStatus.toString()
      + ". Breaking monitoring loop");
  return false;

代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

for (YarnApplicationState state : YarnApplicationState.values()) {
 states.add(StringUtils.toLowerCase(state.toString()));
YarnApplicationState state = rmapp.createApplicationState();
String type = StringUtils.toLowerCase(rmapp.getApplicationType().trim());
if (states.contains(StringUtils.toLowerCase(state.toString()))) {
 if (types.contains(RMWSConsts.ANY)) {
  countApp(scoreboard, state, RMWSConsts.ANY);

代码示例来源:origin: apache/drill

private void updateState(YarnApplicationState newState) {
  state = newState;
  if (verbose) {
   System.out.print("Application State: ");
   System.out.println(state.toString());
   System.out.print("Starting...");
  }
 }
}

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com