Example #1
0
        /// <exception cref="System.Exception"/>
        public virtual void TestJobSubmissionFailure()
        {
            Org.Mockito.Mockito.When(resourceMgrDelegate.SubmitApplication(Matchers.Any <ApplicationSubmissionContext
                                                                                         >())).ThenReturn(appId);
            ApplicationReport report = Org.Mockito.Mockito.Mock <ApplicationReport>();

            Org.Mockito.Mockito.When(report.GetApplicationId()).ThenReturn(appId);
            Org.Mockito.Mockito.When(report.GetDiagnostics()).ThenReturn(failString);
            Org.Mockito.Mockito.When(report.GetYarnApplicationState()).ThenReturn(YarnApplicationState
                                                                                  .Failed);
            Org.Mockito.Mockito.When(resourceMgrDelegate.GetApplicationReport(appId)).ThenReturn
                (report);
            Credentials  credentials = new Credentials();
            FilePath     jobxml      = new FilePath(testWorkDir, "job.xml");
            OutputStream @out        = new FileOutputStream(jobxml);

            conf.WriteXml(@out);
            @out.Close();
            try
            {
                yarnRunner.SubmitJob(jobId, testWorkDir.GetAbsolutePath().ToString(), credentials
                                     );
            }
            catch (IOException io)
            {
                Log.Info("Logging exception:", io);
                NUnit.Framework.Assert.IsTrue(io.GetLocalizedMessage().Contains(failString));
            }
        }
Example #2
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        public override JobStatus SubmitJob(JobID jobId, string jobSubmitDir, Credentials
                                            ts)
        {
            AddHistoryToken(ts);
            // Construct necessary information to start the MR AM
            ApplicationSubmissionContext appContext = CreateApplicationSubmissionContext(conf
                                                                                         , jobSubmitDir, ts);

            // Submit to ResourceManager
            try
            {
                ApplicationId     applicationId = resMgrDelegate.SubmitApplication(appContext);
                ApplicationReport appMaster     = resMgrDelegate.GetApplicationReport(applicationId);
                string            diagnostics   = (appMaster == null ? "application report is null" : appMaster
                                                   .GetDiagnostics());
                if (appMaster == null || appMaster.GetYarnApplicationState() == YarnApplicationState
                    .Failed || appMaster.GetYarnApplicationState() == YarnApplicationState.Killed)
                {
                    throw new IOException("Failed to run job : " + diagnostics);
                }
                return(clientCache.GetClient(jobId).GetJobStatus(jobId));
            }
            catch (YarnException e)
            {
                throw new IOException(e);
            }
        }