List of usage examples for org.apache.hadoop.yarn.api.records FinalApplicationStatus UNDEFINED
FinalApplicationStatus UNDEFINED
To view the source code for org.apache.hadoop.yarn.api.records FinalApplicationStatus UNDEFINED.
Click Source Link
From source file:org.apache.tez.dag.app.rm.TaskSchedulerEventHandler.java
License:Apache License
@Override public AppFinalStatus getFinalAppStatus() { FinalApplicationStatus finishState = FinalApplicationStatus.UNDEFINED; StringBuffer sb = new StringBuffer(); if (dagAppMaster == null) { finishState = FinalApplicationStatus.UNDEFINED; sb.append("App not yet initialized"); } else {//from w w w . j a va 2 s . com DAGAppMasterState appMasterState = dagAppMaster.getState(); if (appMasterState == DAGAppMasterState.SUCCEEDED) { finishState = FinalApplicationStatus.SUCCEEDED; } else if (appMasterState == DAGAppMasterState.KILLED || (appMasterState == DAGAppMasterState.RUNNING && isSignalled)) { finishState = FinalApplicationStatus.KILLED; } else if (appMasterState == DAGAppMasterState.FAILED || appMasterState == DAGAppMasterState.ERROR) { finishState = FinalApplicationStatus.FAILED; } else { finishState = FinalApplicationStatus.UNDEFINED; } List<String> diagnostics = dagAppMaster.getDiagnostics(); if (diagnostics != null) { for (String s : diagnostics) { sb.append(s).append("\n"); } } } if (LOG.isDebugEnabled()) { LOG.debug("Setting job diagnostics to " + sb.toString()); } // if history url is set use the same, if historyUrl is set to "" then rm ui disables the // history url return new AppFinalStatus(finishState, sb.toString(), historyUrl); }
From source file:org.apache.tez.dag.app.rm.TaskSchedulerManager.java
License:Apache License
public AppFinalStatus getFinalAppStatus() { FinalApplicationStatus finishState = FinalApplicationStatus.UNDEFINED; StringBuffer sb = new StringBuffer(); if (dagAppMaster == null) { finishState = FinalApplicationStatus.UNDEFINED; sb.append("App not yet initialized"); } else {//from www . ja va2s .c o m DAGAppMasterState appMasterState = dagAppMaster.getState(); if (appMasterState == DAGAppMasterState.SUCCEEDED) { finishState = FinalApplicationStatus.SUCCEEDED; } else if (appMasterState == DAGAppMasterState.KILLED || (appMasterState == DAGAppMasterState.RUNNING && isSignalled)) { finishState = FinalApplicationStatus.KILLED; } else if (appMasterState == DAGAppMasterState.FAILED || appMasterState == DAGAppMasterState.ERROR) { finishState = FinalApplicationStatus.FAILED; } else { finishState = FinalApplicationStatus.UNDEFINED; } List<String> diagnostics = dagAppMaster.getDiagnostics(); if (diagnostics != null) { for (String s : diagnostics) { sb.append(s).append("\n"); } } } if (LOG.isDebugEnabled()) { LOG.debug("Setting job diagnostics to " + sb.toString()); } // if history url is set use the same, if historyUrl is set to "" then rm ui disables the // history url return new AppFinalStatus(finishState, sb.toString(), historyUrl); }
From source file:org.apache.tez.hadoop.shim.TestHadoopShim28.java
License:Apache License
@Test public void testApplyFinalApplicationStatusCorrection() { HadoopShim shim = new HadoopShim28(); // Session mode success/failure, change to ended Assert.assertEquals(FinalApplicationStatus.ENDED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.SUCCEEDED, true, false)); Assert.assertEquals(FinalApplicationStatus.ENDED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.FAILED, true, false)); // Non-session mode success/failure, retain success/failure Assert.assertEquals(FinalApplicationStatus.SUCCEEDED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.SUCCEEDED, false, false)); Assert.assertEquals(FinalApplicationStatus.FAILED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.FAILED, false, false)); // Session and non-session mode error, retain failed. Assert.assertEquals(FinalApplicationStatus.FAILED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.FAILED, true, true)); Assert.assertEquals(FinalApplicationStatus.FAILED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.FAILED, false, true)); // Session and non-session mode killed is killed. Assert.assertEquals(FinalApplicationStatus.KILLED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.KILLED, true, false)); Assert.assertEquals(FinalApplicationStatus.KILLED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.KILLED, false, false)); // Session and non-session mode undefined is undefined. Assert.assertEquals(FinalApplicationStatus.UNDEFINED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.UNDEFINED, true, false)); Assert.assertEquals(FinalApplicationStatus.UNDEFINED, shim.applyFinalApplicationStatusCorrection(FinalApplicationStatus.UNDEFINED, false, false)); }
From source file:org.apache.tez.mapreduce.client.NotRunningJob.java
License:Apache License
private ApplicationReport getUnknownApplicationReport() { ApplicationId unknownAppId = recordFactory.newRecordInstance(ApplicationId.class); ApplicationAttemptId unknownAttemptId = recordFactory.newRecordInstance(ApplicationAttemptId.class); // Setting AppState to NEW and finalStatus to UNDEFINED as they are never // used for a non running job return ApplicationReport.newInstance(unknownAppId, unknownAttemptId, "N/A", "N/A", "N/A", "N/A", 0, null, YarnApplicationState.NEW, "N/A", "N/A", 0, 0, FinalApplicationStatus.UNDEFINED, null, "N/A", 0.0f, "TEZ_MRR", null); }
From source file:org.apache.twill.yarn.YarnTwillController.java
License:Apache License
@Override protected synchronized void doShutDown() { if (processController == null) { LOG.warn("No process controller for application that is not submitted."); return;//from w w w. j a va 2 s . c o m } // Stop polling if it is running. stopPollStatus(); // Wait for the stop message being processed try { Uninterruptibles.getUninterruptibly(getStopMessageFuture(), Constants.APPLICATION_MAX_STOP_SECONDS, TimeUnit.SECONDS); } catch (Exception e) { LOG.error("Failed to wait for stop message being processed.", e); // Kill the application through yarn kill(); } // Poll application status from yarn try { Stopwatch stopWatch = new Stopwatch(); stopWatch.start(); long maxTime = TimeUnit.MILLISECONDS.convert(Constants.APPLICATION_MAX_STOP_SECONDS, TimeUnit.SECONDS); YarnApplicationReport report = processController.getReport(); FinalApplicationStatus finalStatus = report.getFinalApplicationStatus(); ApplicationId appId = report.getApplicationId(); while (finalStatus == FinalApplicationStatus.UNDEFINED && stopWatch.elapsedTime(TimeUnit.MILLISECONDS) < maxTime) { LOG.debug("Yarn application final status for {} {}: {}", appName, appId, finalStatus); TimeUnit.SECONDS.sleep(1); stopWatch.reset(); stopWatch.start(); finalStatus = processController.getReport().getFinalApplicationStatus(); } LOG.debug("Yarn application {} {} completed with status {}", appName, appId, finalStatus); // Application not finished after max stop time, kill the application if (finalStatus == FinalApplicationStatus.UNDEFINED) { kill(); } } catch (Exception e) { LOG.warn("Exception while waiting for application report: {}", e.getMessage(), e); kill(); } super.doShutDown(); }
From source file:org.apache.twill.yarn.YarnTwillController.java
License:Apache License
private Runnable createStatusPollingRunnable() { return new Runnable() { @Override//from w w w .ja va2s. c o m public void run() { YarnApplicationReport report = processController.getReport(); ApplicationId appId = report.getApplicationId(); boolean shutdown = false; boolean watchInstanceNode = false; try { LOG.debug("Polling status from Yarn for {} {}.", appName, appId); while (!Thread.currentThread().isInterrupted()) { if (report.getFinalApplicationStatus() != FinalApplicationStatus.UNDEFINED) { shutdown = true; break; } // Make a sync exists call to instance node and re-watch if the node exists try { // The timeout is arbitrary, as it's just for avoiding block forever Stat stat = zkClient.exists(getInstancePath()).get(5, TimeUnit.SECONDS); if (stat != null) { watchInstanceNode = true; break; } } catch (ExecutionException e) { // Ignore the exception, as any exception won't affect the status polling. LOG.debug("Failed in exists call on ZK path {}.", getInstancePath(), e); } catch (TimeoutException e) { LOG.debug("Timeout in exists call on ZK path {}.", getInstancePath(), e); } TimeUnit.SECONDS.sleep(1); report = processController.getReport(); } } catch (InterruptedException e) { // OK to ignore. LOG.debug("Status polling thread interrupted for application {} {}", appName, appId); } LOG.debug("Stop polling status from Yarn for {} {}.", appName, appId); if (shutdown) { LOG.info("Yarn application {} {} completed. Shutting down controller.", appName, appId); forceShutDown(); } else if (watchInstanceNode) { LOG.info("Rewatch instance node for {} {} at {}", appName, appId, getInstancePath()); synchronized (YarnTwillController.this) { statusPollingThread = null; watchInstanceNode(); } } } }; }
From source file:yarnkit.client.YarnClientService.java
License:Apache License
@Override protected void runOneIteration() throws Exception { if (isApplicationFinished()) { LOG.info("Nothing to do, application is finished"); return;/*from w w w . j a v a 2 s. co m*/ } ApplicationReport report = getApplicationReport(); if (report == null) { LOG.error("No application report received"); } else if (DONE.contains(report.getYarnApplicationState()) || report.getFinalApplicationStatus() != FinalApplicationStatus.UNDEFINED) { finalReport = report; stop(); } // Ensure that we haven't been running for all that long. if (parameters.getClientTimeoutMillis() > 0 && stopwatch.elapsedMillis() > parameters.getClientTimeoutMillis()) { LOG.warn("Stopping application due to timeout."); timeout = true; stop(); } }