Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-3608

Apps submitted to MiniYarnCluster always stay in ACCEPTED state.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.6.0
    • Fix Version/s: None
    • Component/s: applications
    • Labels:
      None

      Description

      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.

       @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();
          }
        }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ozawa Tsuyoshi Ozawa
                Reporter:
                spandan Spandan Dutta
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: