hadoop-yarn-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Spandan Dutta (JIRA)" <j...@apache.org>
Subject [jira] [Created] (YARN-3608) Apps submitted to MiniYarnCluster always stay in ACCEPTED state.
Date Fri, 08 May 2015 21:35:02 GMT
Spandan Dutta created YARN-3608:
-----------------------------------

             Summary: Apps submitted to MiniYarnCluster always stay in ACCEPTED state.
                 Key: YARN-3608
                 URL: https://issues.apache.org/jira/browse/YARN-3608
             Project: Hadoop YARN
          Issue Type: Bug
          Components: applications
    Affects Versions: 2.6.0
            Reporter: Spandan Dutta


So I adapted a test case to submit a yarn app to a MiniYarnCluster and wait for it to reach
running state. Turns out that the app gets stuck in "ACCEPTED" state. 
{noformat}
 @Test
  public void testGetAllQueues() throws IOException, YarnException, InterruptedException {
    MiniYARNCluster cluster = new MiniYARNCluster("testMRAMTokens", 1, 1, 1);
    YarnClient rmClient = null;
    try {
      cluster.init(new YarnConfiguration());
      cluster.start();
      final Configuration yarnConf = cluster.getConfig();
      rmClient = YarnClient.createYarnClient();
      rmClient.init(yarnConf);
      rmClient.start();
      YarnClientApplication newApp = rmClient.createApplication();

      ApplicationId appId = newApp.getNewApplicationResponse().getApplicationId();

      // Create launch context for app master
      ApplicationSubmissionContext appContext
          = Records.newRecord(ApplicationSubmissionContext.class);

      // set the application id
      appContext.setApplicationId(appId);

      // set the application name
      appContext.setApplicationName("test");

      // Set up the container launch context for the application master
      ContainerLaunchContext amContainer
          = Records.newRecord(ContainerLaunchContext.class);

      appContext.setAMContainerSpec(amContainer);
      appContext.setResource(Resource.newInstance(1024, 1));

      // Submit the application to the applications manager
      rmClient.submitApplication(appContext);
      ApplicationReport applicationReport =
          rmClient.getApplicationReport(appContext.getApplicationId());

      int timeout = 10;
      while(timeout > 0 && applicationReport.getYarnApplicationState() !=
          YarnApplicationState.RUNNING) {
        Thread.sleep(5 * 1000);
        timeout--;
      }
      Assert.assertTrue(timeout != 0);
      Assert.assertTrue(applicationReport.getYarnApplicationState()
          == YarnApplicationState.RUNNING);
      List<QueueInfo> queues = rmClient.getAllQueues();
      Assert.assertNotNull(queues);
      Assert.assertTrue(!queues.isEmpty());
      QueueInfo queue = queues.get(0);
      List<ApplicationReport> queueApplications = queue.getApplications();
      Assert.assertFalse(queueApplications.isEmpty());
    } catch (YarnException e) {
      Assert.assertTrue(e.getMessage().contains("Failed to submit"));
    } finally {
      if (rmClient != null) {
        rmClient.stop();
      }
      cluster.stop();
    }
  }
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message