本文整理了Java中org.apache.hadoop.yarn.api.records.YarnApplicationState.toString()
方法的一些代码示例,展示了YarnApplicationState.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YarnApplicationState.toString()
方法的具体详情如下:
包路径:org.apache.hadoop.yarn.api.records.YarnApplicationState
类名称:YarnApplicationState
方法名:toString
暂无
代码示例来源: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...");
}
}
}
代码示例来源:origin: apache/drill
private void updateState(YarnApplicationState newState) {
YarnApplicationState oldState = state;
state = newState;
if (oldState == null) {
return;
}
System.out.println();
System.out.print("Application State: ");
System.out.println(state.toString());
System.out.print("Stopping...");
}
}
代码示例来源: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: 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: alibaba/jstorm
+ ", 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: Qihoo360/XLearning
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: apache/metron
+ ", appMasterRpcPort=" + report.getRpcPort()
+ ", appStartTime=" + report.getStartTime()
+ ", yarnAppState=" + report.getYarnApplicationState().toString()
+ ", distributedFinalState=" + report.getFinalApplicationStatus().toString()
+ ", appTrackingUrl=" + report.getTrackingUrl()
+ " 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: com.github.jiayuhan-it/hadoop-yarn-server-common
private String clarifyAppState(YarnApplicationState state) {
String ret = state.toString();
switch (state) {
case NEW:
return ret + ": waiting for application to be initialized";
case NEW_SAVING:
return ret + ": waiting for application to be persisted in state-store.";
case SUBMITTED:
return ret + ": waiting for application to be accepted by scheduler.";
case ACCEPTED:
return ret + ": waiting for AM container to be allocated, launched and"
+ " register with RM.";
case RUNNING:
return ret + ": AM has registered with RM and started running.";
default:
return ret;
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-common
private String clarifyAppState(YarnApplicationState state) {
String ret = state.toString();
switch (state) {
case NEW:
return ret + ": waiting for application to be initialized";
case NEW_SAVING:
return ret + ": waiting for application to be persisted in state-store.";
case SUBMITTED:
return ret + ": waiting for application to be accepted by scheduler.";
case ACCEPTED:
return ret + ": waiting for AM container to be allocated, launched and"
+ " register with RM.";
case RUNNING:
return ret + ": AM has registered with RM and started running.";
default:
return ret;
}
}
代码示例来源: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: apache/samza
/**
* This function returns the state of a given application. This state can be on of the
* {"NEW", "NEW_SAVING", "SUBMITTED", "ACCEPTED", "RUNNING", "FINISHED", "FAILED", "KILLED"}
*
* @param applicationId the application id of the application the state is being queried
* @return the state of the application which is one of the following values: {"NEW", "NEW_SAVING", "SUBMITTED", "ACCEPTED", "RUNNING", "FINISHED", "FAILED", "KILLED"}
* @throws IOException Throws IO exception
* @throws YarnException in case of errors or if YARN rejects the request due to
* access-control restrictions.
*/
public String getApplicationState(String applicationId) throws IOException, YarnException {
return yarnClient.getApplicationReport(getApplicationIDFromString(applicationId)).getYarnApplicationState().toString();
}
代码示例来源: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: org.springframework.cloud/spring-cloud-deployer-yarn
public Collection<CloudAppInstanceInfo> getSubmittedApplications(String yarnApplicationId) {
List<CloudAppInstanceInfo> appIds = new ArrayList<CloudAppInstanceInfo>();
for (ApplicationReport report : yarnClient.listApplications("DATAFLOW")) {
if (report.getApplicationId().toString().equals(yarnApplicationId)) {
appIds.add(new CloudAppInstanceInfo(report.getApplicationId().toString(), report.getName(),
report.getYarnApplicationState().toString(), report.getOriginalTrackingUrl()));
}
}
return appIds;
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
@Test
public void testRequestWithValidStateQueries() {
GetApplicationsRequest request = ApplicationsRequestBuilder.create()
.withStatesQuery(
Sets.newHashSet(YarnApplicationState.NEW_SAVING.toString(),
YarnApplicationState.NEW.toString()))
.build();
GetApplicationsRequest expectedRequest = getDefaultRequest();
Set<String> appStates =
Sets.newHashSet(YarnApplicationState.NEW_SAVING.toString(),
YarnApplicationState.NEW.toString());
Set<String> appStatesLowerCase = parseQueries(appStates, true);
expectedRequest.setApplicationStates(appStatesLowerCase);
assertEquals(expectedRequest, request);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager
@Test
public void testRequestWithValidStateQuery() {
GetApplicationsRequest request = ApplicationsRequestBuilder.create()
.withStateQuery(YarnApplicationState.NEW_SAVING.toString()).build();
GetApplicationsRequest expectedRequest = getDefaultRequest();
Set<String> appStates =
Sets.newHashSet(YarnApplicationState.NEW_SAVING.toString());
Set<String> appStatesLowerCase = parseQueries(appStates, true);
expectedRequest.setApplicationStates(appStatesLowerCase);
assertEquals(expectedRequest, request);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-applicationhistoryservice
@Test
public void testView() throws Exception {
Injector injector =
WebAppTests.createMockInjector(ApplicationBaseProtocol.class,
mockApplicationHistoryClientService(5, 1, 1));
AHSView ahsViewInstance = injector.getInstance(AHSView.class);
ahsViewInstance.render();
WebAppTests.flushOutput(injector);
ahsViewInstance.set(YarnWebParams.APP_STATE,
YarnApplicationState.FAILED.toString());
ahsViewInstance.render();
WebAppTests.flushOutput(injector);
ahsViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
YarnApplicationState.FAILED.toString(), YarnApplicationState.KILLED));
ahsViewInstance.render();
WebAppTests.flushOutput(injector);
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-common
@Test public void testGetApp() {
LogWebService.AppInfo app =
logWebService.getApp(request, appId.toString(), null);
Assert.assertEquals("RUNNING", app.getAppState().toString());
Assert.assertEquals(user, app.getUser());
}
代码示例来源:origin: org.apache.hadoop/hadoop-yarn-server-applicationhistoryservice
@Test
public void testAppsQuery() throws Exception {
WebResource r = resource();
ClientResponse response =
r.path("ws").path("v1").path("applicationhistory").path("apps")
.queryParam("state", YarnApplicationState.FINISHED.toString())
.queryParam("user.name", USERS[round])
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON + "; " + JettyUtils.UTF_8,
response.getType().toString());
JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length());
JSONObject apps = json.getJSONObject("apps");
assertEquals("incorrect number of elements", 1, apps.length());
JSONArray array = apps.getJSONArray("app");
assertEquals("incorrect number of elements", MAX_APPS, array.length());
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
@Test
public void testAppsQueryStatesNone() throws JSONException, Exception {
rm.start();
MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
rm.submitApp(CONTAINER_MB);
amNodeManager.nodeHeartbeat(true);
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("cluster")
.path("apps")
.queryParam("states", YarnApplicationState.RUNNING.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length());
assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
rm.stop();
}
代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager
@Test
public void testAppsQueryStateNone() throws JSONException, Exception {
rm.start();
MockNM amNodeManager = rm.registerNode("127.0.0.1:1234", 2048);
rm.submitApp(CONTAINER_MB);
amNodeManager.nodeHeartbeat(true);
WebResource r = resource();
ClientResponse response = r.path("ws").path("v1").path("cluster")
.path("apps")
.queryParam("state", YarnApplicationState.RUNNING.toString())
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
JSONObject json = response.getEntity(JSONObject.class);
assertEquals("incorrect number of elements", 1, json.length());
assertEquals("apps is not null", JSONObject.NULL, json.get("apps"));
rm.stop();
}
内容来源于网络,如有侵权,请联系作者删除!