Tabnine Logo
RMApp.getState
Code IndexAdd Tabnine to your IDE (free)

How to use
getState
method
in
org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp

Best Java code snippets using org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp.getState (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void removeCompletedApps(DecommissioningNodeContext context) {
 Iterator<ApplicationId> it = context.appIds.iterator();
 while (it.hasNext()) {
  ApplicationId appId = it.next();
  RMApp rmApp = rmContext.getRMApps().get(appId);
  if (rmApp == null) {
   LOG.debug("Consider non-existing app " + appId + " as completed");
   it.remove();
   continue;
  }
  if (rmApp.getState() == RMAppState.FINISHED ||
    rmApp.getState() == RMAppState.FAILED ||
    rmApp.getState() == RMAppState.KILLED) {
   LOG.debug("Remove " + rmApp.getState() + " app " + appId);
   it.remove();
  }
 }
}
origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

public static boolean isAppInFinalState(RMApp rmApp) {
 RMAppState appState = ((RMAppImpl) rmApp).getRecoveredFinalState();
 if (appState == null) {
  appState = rmApp.getState();
 }
 return appState == RMAppState.FAILED || appState == RMAppState.FINISHED
   || appState == RMAppState.KILLED;
}

origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

public static boolean isAppInFinalState(RMApp rmApp) {
 RMAppState appState = ((RMAppImpl) rmApp).getRecoveredFinalState();
 if (appState == null) {
  appState = rmApp.getState();
 }
 return appState == RMAppState.FAILED || appState == RMAppState.FINISHED
   || appState == RMAppState.KILLED;
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public static boolean isAppInFinalState(RMApp rmApp) {
 RMAppState appState = ((RMAppImpl) rmApp).getRecoveredFinalState();
 if (appState == null) {
  appState = rmApp.getState();
 }
 return appState == RMAppState.FAILED || appState == RMAppState.FINISHED
   || appState == RMAppState.KILLED;
}

origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

@Inject
public FairSchedulerAppsBlock(ResourceManager rm, ViewContext ctx,
  Configuration conf) {
 super(ctx);
 FairScheduler scheduler = (FairScheduler) rm.getResourceScheduler();
 fsinfo = new FairSchedulerInfo(scheduler);
 apps = new ConcurrentHashMap<ApplicationId, RMApp>();
 for (Map.Entry<ApplicationId, RMApp> entry : rm.getRMContext().getRMApps()
   .entrySet()) {
  if (!(RMAppState.NEW.equals(entry.getValue().getState())
    || RMAppState.NEW_SAVING.equals(entry.getValue().getState())
    || RMAppState.SUBMITTED.equals(entry.getValue().getState()))) {
   apps.put(entry.getKey(), entry.getValue());
  }
 }
 this.conf = conf;
 this.rm = rm;
}

origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Inject
public FairSchedulerAppsBlock(ResourceManager rm, ViewContext ctx,
  Configuration conf) {
 super(ctx);
 FairScheduler scheduler = (FairScheduler) rm.getResourceScheduler();
 fsinfo = new FairSchedulerInfo(scheduler);
 apps = new ConcurrentHashMap<ApplicationId, RMApp>();
 for (Map.Entry<ApplicationId, RMApp> entry : rm.getRMContext().getRMApps()
   .entrySet()) {
  if (!(RMAppState.NEW.equals(entry.getValue().getState())
    || RMAppState.NEW_SAVING.equals(entry.getValue().getState())
    || RMAppState.SUBMITTED.equals(entry.getValue().getState()))) {
   apps.put(entry.getKey(), entry.getValue());
  }
 }
 this.conf = conf;
 this.rm = rm;
}

origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Inject
public FairSchedulerAppsBlock(ResourceManager rm, ViewContext ctx,
  Configuration conf) {
 super(ctx);
 FairScheduler scheduler = (FairScheduler) rm.getResourceScheduler();
 fsinfo = new FairSchedulerInfo(scheduler);
 apps = new ConcurrentHashMap<ApplicationId, RMApp>();
 for (Map.Entry<ApplicationId, RMApp> entry : rm.getRMContext().getRMApps()
   .entrySet()) {
  if (!(RMAppState.NEW.equals(entry.getValue().getState())
    || RMAppState.NEW_SAVING.equals(entry.getValue().getState())
    || RMAppState.SUBMITTED.equals(entry.getValue().getState()))) {
   apps.put(entry.getKey(), entry.getValue());
  }
 }
 this.conf = conf;
 this.rm = rm;
}

origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

protected void addToCompletedApps(TestRMAppManager appMonitor, RMContext rmContext) {
 for (RMApp app : rmContext.getRMApps().values()) {
  if (app.getState() == RMAppState.FINISHED
    || app.getState() == RMAppState.KILLED 
    || app.getState() == RMAppState.FAILED) {
   appMonitor.finishApplication(app.getApplicationId());
  }
 }
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private static void assertAppState(RMAppState state, RMApp application) {
 Assert.assertEquals("application state should have been " + state, 
   state, application.getState());
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private static void assertAppState(RMAppState state, RMApp application) {
 Assert.assertEquals("application state should have been " + state, 
   state, application.getState());
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

public void waitForState(ApplicationId appId, RMAppState finalState)
  throws Exception {
 RMApp app = getRMContext().getRMApps().get(appId);
 Assert.assertNotNull("app shouldn't be null", app);
 int timeoutSecs = 0;
 while (!finalState.equals(app.getState()) && timeoutSecs++ < 40) {
  System.out.println("App : " + appId + " State is : " + app.getState()
    + " Waiting for state : " + finalState);
  Thread.sleep(2000);
 }
 System.out.println("App State is : " + app.getState());
 Assert.assertEquals("App state is not correct (timedout)", finalState,
   app.getState());
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void addToCompletedApps(TestRMAppManager appMonitor,
    RMContext rmContext) {
 // ensure applications are finished in order by their IDs
 List<RMApp> sortedApps = new ArrayList<>(rmContext.getRMApps().values());
 sortedApps.sort(Comparator.comparingInt(o -> o.getApplicationId().getId()));
 for (RMApp app : sortedApps) {
  if (app.getState() == RMAppState.FINISHED
    || app.getState() == RMAppState.KILLED
    || app.getState() == RMAppState.FAILED) {
   appMonitor.finishApplication(app.getApplicationId());
  }
 }
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void failOverAndKillApp(ApplicationId appId,
  ApplicationAttemptId appAttemptId, RMAppState initialRMAppState,
  RMAppAttemptState initialRMAppAttemptState,
  RMAppState expectedAppStateBeforeKillApp) throws Exception {
 Assert.assertEquals(initialRMAppState,
   rm1.getRMContext().getRMApps().get(appId).getState());
 Assert.assertEquals(initialRMAppAttemptState, rm1.getRMContext()
   .getRMApps().get(appId).getAppAttempts().get(appAttemptId).getState());
 explicitFailover();
 Assert.assertEquals(expectedAppStateBeforeKillApp,
   rm2.getRMContext().getRMApps().get(appId).getState());
 killApplication(rm2, appId, appAttemptId, initialRMAppState);
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private void failOverAndKillApp(ApplicationId appId,
  ApplicationAttemptId appAttemptId, RMAppState initialRMAppState,
  RMAppAttemptState initialRMAppAttemptState,
  RMAppState expectedAppStateBeforeKillApp) throws Exception {
 Assert.assertEquals(initialRMAppState,
   rm1.getRMContext().getRMApps().get(appId).getState());
 Assert.assertEquals(initialRMAppAttemptState, rm1.getRMContext()
   .getRMApps().get(appId).getAppAttempts().get(appAttemptId).getState());
 explicitFailover();
 Assert.assertEquals(expectedAppStateBeforeKillApp,
   rm2.getRMContext().getRMApps().get(appId).getState());
 killApplication(rm2, appId, appAttemptId, initialRMAppState);
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private void failOverAndKillApp(ApplicationId appId,
  RMAppState initialRMAppState) throws Exception {
 Assert.assertEquals(initialRMAppState,
   rm1.getRMContext().getRMApps().get(appId).getState());
 explicitFailover();
 Assert.assertTrue(rm2.getRMContext().getRMApps().get(appId) == null);
 killApplication(rm2, appId, null, initialRMAppState);
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private void failOverAndKillApp(ApplicationId appId,
  RMAppState initialRMAppState) throws Exception {
 Assert.assertEquals(initialRMAppState,
   rm1.getRMContext().getRMApps().get(appId).getState());
 explicitFailover();
 Assert.assertTrue(rm2.getRMContext().getRMApps().get(appId) == null);
 killApplication(rm2, appId, null, initialRMAppState);
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Test
public void testRMAppSubmit() throws Exception {
 appMonitor.submitApplication(asContext, "test");
 RMApp app = rmContext.getRMApps().get(appId);
 Assert.assertNotNull("app is null", app);
 Assert.assertEquals("app id doesn't match", appId, app.getApplicationId());
 Assert.assertEquals("app state doesn't match", RMAppState.NEW, app.getState());
 verify(metricsPublisher).appACLsUpdated(
   any(RMApp.class), any(String.class), anyLong());
 // wait for event to be processed
 int timeoutSecs = 0;
 while ((getAppEventType() == RMAppEventType.KILL) && 
   timeoutSecs++ < 20) {
  Thread.sleep(1000);
 }
 Assert.assertEquals("app event type sent is wrong", RMAppEventType.START,
   getAppEventType());
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

private RMApp testRMAppSubmit() throws Exception {
 appMonitor.submitApplication(asContext, "test");
 RMApp app = rmContext.getRMApps().get(appId);
 Assert.assertNotNull("app is null", app);
 Assert.assertEquals("app id doesn't match", appId, app.getApplicationId());
 Assert.assertEquals("app state doesn't match", RMAppState.NEW, app.getState());
 // wait for event to be processed
 int timeoutSecs = 0;
 while ((getAppEventType() == RMAppEventType.KILL) &&
   timeoutSecs++ < 20) {
  Thread.sleep(1000);
 }
 Assert.assertEquals("app event type sent is wrong", RMAppEventType.START,
   getAppEventType());
 return app;
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test(timeout = 10000)
public void testAutoCreateLeafQueueFailsWithNoQueueMapping()
  throws Exception {
 final String INVALID_USER = "invalid_user";
 // submit an app under a different queue name which does not exist
 // and queue mapping does not exist for this user
 RMApp app = mockRM.submitApp(GB, "app", INVALID_USER, null, INVALID_USER,
   false);
 mockRM.drainEvents();
 mockRM.waitForState(app.getApplicationId(), RMAppState.FAILED);
 assertEquals(RMAppState.FAILED, app.getState());
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Test (timeout = 30000)
public void testRMAppSubmitDuplicateApplicationId() throws Exception {
 ApplicationId appId = MockApps.newAppID(0);
 asContext.setApplicationId(appId);
 RMApp appOrig = rmContext.getRMApps().get(appId);
 Assert.assertTrue("app name matches but shouldn't", "testApp1" != appOrig.getName());
 // our testApp1 should be rejected and original app with same id should be left in place
 try {
  appMonitor.submitApplication(asContext, "test");
  Assert.fail("Exception is expected when applicationId is duplicate.");
 } catch (YarnException e) {
  Assert.assertTrue("The thrown exception is not the expectd one.",
    e.getMessage().contains("Cannot add a duplicate!"));
 }
 // make sure original app didn't get removed
 RMApp app = rmContext.getRMApps().get(appId);
 Assert.assertNotNull("app is null", app);
 Assert.assertEquals("app id doesn't match", appId, app.getApplicationId());
 Assert.assertEquals("app state doesn't match", RMAppState.FINISHED, app.getState());
}
org.apache.hadoop.yarn.server.resourcemanager.rmappRMAppgetState

Javadoc

The current state of the RMApp.

Popular methods of RMApp

  • getCurrentAppAttempt
    RMApp can have multiple application attempts RMAppAttempt. This method returns the current RMAppAtte
  • getRMAppAttempt
    RMApp can have multiple application attempts RMAppAttempt. This method returns the RMAppAttempt corr
  • getApplicationId
    The application id for this RMApp.
  • getProgress
    Progress of application.
  • createAndGetApplicationReport
    To get the status of an application in the RM, this method can be used. If full access is not allowe
  • createApplicationState
    Create the external user-facing state of ApplicationMaster from the current state of the RMApp.
  • getAppAttempts
    RMApp can have multiple application attempts RMAppAttempt. This method returns the all RMAppAttempts
  • getApplicationSubmissionContext
    The application submission context for this RMApp
  • getApplicationTags
    Get tags for the application
  • getApplicationType
    Returns the application type
  • getDiagnostics
    the diagnostics information for the application master.
  • getFinalApplicationStatus
    The final finish state of the AM when unregistering as in FinishApplicationMasterRequest#setFinalApp
  • getDiagnostics,
  • getFinalApplicationStatus,
  • getFinishTime,
  • getMaxAppAttempts,
  • getName,
  • getQueue,
  • getRMAppMetrics,
  • getStartTime,
  • getSubmitTime

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • startActivity (Activity)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now