Exemple #1
0
        public virtual void TestFromYarn()
        {
            int appStartTime                       = 612354;
            int appFinishTime                      = 612355;
            YarnApplicationState state             = YarnApplicationState.Running;
            ApplicationId        applicationId     = ApplicationId.NewInstance(0, 0);
            ApplicationReport    applicationReport = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                     <ApplicationReport>();

            applicationReport.SetApplicationId(applicationId);
            applicationReport.SetYarnApplicationState(state);
            applicationReport.SetStartTime(appStartTime);
            applicationReport.SetFinishTime(appFinishTime);
            applicationReport.SetUser("TestTypeConverter-user");
            ApplicationResourceUsageReport appUsageRpt = Org.Apache.Hadoop.Yarn.Util.Records.
                                                         NewRecord <ApplicationResourceUsageReport>();
            Resource r = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <Resource>();

            r.SetMemory(2048);
            appUsageRpt.SetNeededResources(r);
            appUsageRpt.SetNumReservedContainers(1);
            appUsageRpt.SetNumUsedContainers(3);
            appUsageRpt.SetReservedResources(r);
            appUsageRpt.SetUsedResources(r);
            applicationReport.SetApplicationResourceUsageReport(appUsageRpt);
            JobStatus jobStatus = TypeConverter.FromYarn(applicationReport, "dummy-jobfile");

            NUnit.Framework.Assert.AreEqual(appStartTime, jobStatus.GetStartTime());
            NUnit.Framework.Assert.AreEqual(appFinishTime, jobStatus.GetFinishTime());
            NUnit.Framework.Assert.AreEqual(state.ToString(), jobStatus.GetState().ToString()
                                            );
        }
Exemple #2
0
        public static ApplicationReport NewApplicationReport(ApplicationId applicationId,
                                                             ApplicationAttemptId applicationAttemptId, string user, string queue, string name
                                                             , string host, int rpcPort, Org.Apache.Hadoop.Yarn.Api.Records.Token clientToAMToken
                                                             , YarnApplicationState state, string diagnostics, string url, long startTime, long
                                                             finishTime, FinalApplicationStatus finalStatus, ApplicationResourceUsageReport
                                                             appResources, string origTrackingUrl, float progress, string appType, Org.Apache.Hadoop.Yarn.Api.Records.Token
                                                             amRmToken, ICollection <string> tags)
        {
            ApplicationReport report = recordFactory.NewRecordInstance <ApplicationReport>();

            report.SetApplicationId(applicationId);
            report.SetCurrentApplicationAttemptId(applicationAttemptId);
            report.SetUser(user);
            report.SetQueue(queue);
            report.SetName(name);
            report.SetHost(host);
            report.SetRpcPort(rpcPort);
            report.SetClientToAMToken(clientToAMToken);
            report.SetYarnApplicationState(state);
            report.SetDiagnostics(diagnostics);
            report.SetTrackingUrl(url);
            report.SetStartTime(startTime);
            report.SetFinishTime(finishTime);
            report.SetFinalApplicationStatus(finalStatus);
            report.SetApplicationResourceUsageReport(appResources);
            report.SetOriginalTrackingUrl(origTrackingUrl);
            report.SetProgress(progress);
            report.SetApplicationType(appType);
            report.SetAMRMToken(amRmToken);
            report.SetApplicationTags(tags);
            return(report);
        }
Exemple #3
0
            /// <exception cref="System.IO.IOException"/>
            public virtual GetApplicationReportResponse GetApplicationReport(GetApplicationReportRequest
                                                                             request)
            {
                ApplicationId     applicationId = request.GetApplicationId();
                ApplicationReport application   = TestClientRedirect.recordFactory.NewRecordInstance
                                                  <ApplicationReport>();

                application.SetApplicationId(applicationId);
                application.SetFinalApplicationStatus(FinalApplicationStatus.Undefined);
                if (this._enclosing.amRunning)
                {
                    application.SetYarnApplicationState(YarnApplicationState.Running);
                }
                else
                {
                    if (this._enclosing.amRestarting)
                    {
                        application.SetYarnApplicationState(YarnApplicationState.Submitted);
                    }
                    else
                    {
                        application.SetYarnApplicationState(YarnApplicationState.Finished);
                        application.SetFinalApplicationStatus(FinalApplicationStatus.Succeeded);
                    }
                }
                string[] split = TestClientRedirect.Amhostaddress.Split(":");
                application.SetHost(split[0]);
                application.SetRpcPort(System.Convert.ToInt32(split[1]));
                application.SetUser("TestClientRedirect-user");
                application.SetName("N/A");
                application.SetQueue("N/A");
                application.SetStartTime(0);
                application.SetFinishTime(0);
                application.SetTrackingUrl("N/A");
                application.SetDiagnostics("N/A");
                GetApplicationReportResponse response = TestClientRedirect.recordFactory.NewRecordInstance
                                                        <GetApplicationReportResponse>();

                response.SetApplicationReport(application);
                return(response);
            }