gpt4 book ai didi

org.springframework.yarn.client.YarnClient.listApplications()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 05:07:31 25 4
gpt4 key购买 nike

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

YarnClient.listApplications介绍

[英]Gets a list of known applications.
[中]获取已知应用程序的列表。

代码示例

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

/**
 * Finds the current application report.
 *
 * @param client the Yarn client
 * @param applicationId Yarn app application id
 * @return Current application report or <code>NULL</code> if not found
 */
private ApplicationReport findApplicationReport(YarnClient client, ApplicationId applicationId) {
  for (ApplicationReport report : client.listApplications()) {
    if (report.getApplicationId().equals(applicationId)) {
      return report;
    }
  }
  return null;
}

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

@Override
protected ExitStatus handleBeanRun(YarnClient bean, String[] parameters, Set<String> opts) {
  Properties properties = StringUtils.splitArrayElementsIntoProperties(parameters, "=");
  if (opts.contains(OPT_SUBMIT)) {
    bean.submitApplication();
  } else if (opts.contains(OPT_LIST)) {
    printApplicationsReport(bean.listApplications());
  } else if (opts.contains(OPT_KILL)) {
    ApplicationId appId = queryApplicationId(bean,
        properties != null ? properties.getProperty(ARG_APPLICATION_ID) : null);
    if (appId != null) {
      bean.killApplication(appId);
    }
  }
  return ExitStatus.COMPLETED;
}

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

/**
 * Query application id.
 *
 * @param client the yarn client
 * @param applicationId the application id
 * @return the application id if exists, NULL otherwise
 */
protected ApplicationId queryApplicationId(YarnClient client, String applicationId) {
  if (!StringUtils.hasText(applicationId)) {
    return null;
  }
  ApplicationId appId = null;
  for (ApplicationReport a : client.listApplications()) {
    if (a.getApplicationId().toString().equals(applicationId)) {
      appId = a.getApplicationId();
      break;
    }
  }
  return appId;
}

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

/**
 * Finds the current application state.
 *
 * @param client the Yarn client
 * @param applicationId Yarn app application id
 * @return Current application state or <code>NULL</code> if not found
 */
private YarnApplicationState findState(YarnClient client, ApplicationId applicationId) {
  YarnApplicationState state = null;
  for (ApplicationReport report : client.listApplications()) {
    if (report.getApplicationId().equals(applicationId)) {
      state = report.getYarnApplicationState();
      break;
    }
  }
  return state;
}

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

/**
 * Build the report for submitted applications.
 *
 * @param client the client
 * @param verbose the verbose
 * @param type the type
 * @param headers the headers
 * @return the submitted report
 */
protected String getSubmittedReport(YarnClient client, boolean verbose, String type, Map<String,String> headers) {
  SubmittedReportBuilder builder = ApplicationsReport.submittedReportBuilder();
  builder.add(SubmittedField.ID, SubmittedField.USER, SubmittedField.NAME, SubmittedField.QUEUE,
      SubmittedField.TYPE, SubmittedField.STARTTIME, SubmittedField.FINISHTIME, SubmittedField.STATE,
      SubmittedField.FINALSTATUS, SubmittedField.ORIGTRACKURL)
      .sort(SubmittedField.ID);
  if (verbose) {
    builder.from(client.listApplications(type));
  } else {
    builder.from(client.listRunningApplications(type));
  }
  if (headers != null) {
    for (Entry<String, String> entry : headers.entrySet()) {
      builder.header(entry.getKey(), entry.getValue());
    }
  }
  return builder.build().toString();
}

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