Esempio n. 1
0
        public async Task <bool> generateFileAsync(JobReport item)
        {
            using (ExcelEngine excel = new ExcelEngine())
            {
                excel.Excel.DefaultVersion = ExcelVersion.Excel2016;

                IWorkbook workbook = excel.Excel.Workbooks.Create();

                IWorksheet worksheet = excel.Excel.Worksheets[0];

                worksheet.Range["A1"].Text = item.Id.ToString();
                worksheet.Range["B1"].Text = item.Description;

                //// add the rest of the fields once the model has been built correctly

                MemoryStream stream = new MemoryStream();
                workbook.SaveAs(stream);

                workbook.Close();

                await SaveAndView($"Export_{item.HouseNumber}_{item.AddressLine1}.xlsx", "application/msexcel", stream, item.Id);

                return(true);
            }
        }
Esempio n. 2
0
        private Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job GetJob()
        {
            Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job = Org.Mockito.Mockito.Mock <Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                                                                       >();
            JobId         jobId = new JobIdPBImpl();
            ApplicationId appId = ApplicationIdPBImpl.NewInstance(Runtime.CurrentTimeMillis()
                                                                  , 4);

            jobId.SetAppId(appId);
            jobId.SetId(1);
            Org.Mockito.Mockito.When(job.GetID()).ThenReturn(jobId);
            JobReport report = Org.Mockito.Mockito.Mock <JobReport>();

            Org.Mockito.Mockito.When(report.GetStartTime()).ThenReturn(100010L);
            Org.Mockito.Mockito.When(report.GetFinishTime()).ThenReturn(100015L);
            Org.Mockito.Mockito.When(job.GetReport()).ThenReturn(report);
            Org.Mockito.Mockito.When(job.GetName()).ThenReturn("JobName");
            Org.Mockito.Mockito.When(job.GetUserName()).ThenReturn("UserName");
            Org.Mockito.Mockito.When(job.GetQueueName()).ThenReturn("QueueName");
            Org.Mockito.Mockito.When(job.GetState()).ThenReturn(JobState.Succeeded);
            Org.Mockito.Mockito.When(job.GetTotalMaps()).ThenReturn(3);
            Org.Mockito.Mockito.When(job.GetCompletedMaps()).ThenReturn(2);
            Org.Mockito.Mockito.When(job.GetTotalReduces()).ThenReturn(2);
            Org.Mockito.Mockito.When(job.GetCompletedReduces()).ThenReturn(1);
            Org.Mockito.Mockito.When(job.GetCompletedReduces()).ThenReturn(1);
            return(job);
        }
Esempio n. 3
0
 public virtual void VerifyCompleted()
 {
     foreach (Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job in GetContext().GetAllJobs
                  ().Values)
     {
         JobReport jobReport = job.GetReport();
         System.Console.Out.WriteLine("Job start time :" + jobReport.GetStartTime());
         System.Console.Out.WriteLine("Job finish time :" + jobReport.GetFinishTime());
         NUnit.Framework.Assert.IsTrue("Job start time is not less than finish time", jobReport
                                       .GetStartTime() <= jobReport.GetFinishTime());
         NUnit.Framework.Assert.IsTrue("Job finish time is in future", jobReport.GetFinishTime
                                           () <= Runtime.CurrentTimeMillis());
         foreach (Task task in job.GetTasks().Values)
         {
             TaskReport taskReport = task.GetReport();
             System.Console.Out.WriteLine("Task start time : " + taskReport.GetStartTime());
             System.Console.Out.WriteLine("Task finish time : " + taskReport.GetFinishTime());
             NUnit.Framework.Assert.IsTrue("Task start time is not less than finish time", taskReport
                                           .GetStartTime() <= taskReport.GetFinishTime());
             foreach (TaskAttempt attempt in task.GetAttempts().Values)
             {
                 TaskAttemptReport attemptReport = attempt.GetReport();
                 NUnit.Framework.Assert.IsTrue("Attempt start time is not less than finish time",
                                               attemptReport.GetStartTime() <= attemptReport.GetFinishTime());
             }
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Handle a job for a computer
        /// </summary>
        /// <param name="job">The job to handle</param>
        /// <param name="c">The computer to performs the job on</param>
        static void handleJobForComputer(Job job, ComputerInfo c)
        {
            Computer computer = new Computer(c);

            logger.Debug($"\tTasks processing for {c.name}");

            JobReport report = new JobReport()
            {
                computerName  = computer.nameLong,
                startDateTime = now,
                error         = false
            };

            Task.Run(async() => {
                report.tasksReports = await computer.performsTasks(job.tasks);
            }).Wait();

            // Update report
            foreach (JobTaskReport taskReport in report.tasksReports)
            {
                if (taskReport.error)
                {
                    report.error = true;
                    logger.Error($"\tTask failed : {taskReport.extra}");
                }
            }

            report.endDateTime = DateTime.Now;

            // Save the report
            jobStore.insertJobReport(job, report);
        }
Esempio n. 5
0
        public TestOutcome CreateHierarchicalTask()
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskCreate(Hierarchical)";
            try
            {
                TasksApi tasksApi               = new TasksApi(_url);
                IO.Swagger.Model.Task task      = TaskGenerator.GetHierarchicalTask();
                JobReport             job       = tasksApi.TaskCreate(_session.SessionId, "all", task);
                JobReport             polledJob = JobHandler.pollJob(job, _session.SessionId, _url);

                if (polledJob.ErrorMessage != null)
                {
                    outcome.outcome = polledJob.ErrorMessage;
                }
                else
                {
                    outcome.outcome = "Success";
                }
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Esempio n. 6
0
        public TestOutcome UpdateTask(string path)
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Task";
            outcome.methodName = "TaskEdit";
            try
            {
                TasksApi tasksApi          = new TasksApi(_url);
                IO.Swagger.Model.Task task = tasksApi.TaskFind(_session.SessionId, path);
                task.Rows[0].Values["conc"] = "55";
                JobReport job       = tasksApi.TaskEdit(_session.SessionId, path, task);
                JobReport polledJob = JobHandler.pollJob(job, _session.SessionId, _url);

                if (polledJob.ErrorMessage != null)
                {
                    outcome.outcome = polledJob.ErrorMessage;
                }
                else
                {
                    outcome.outcome = "Success";
                }
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Esempio n. 7
0
        public virtual void TestNotifyRetries()
        {
            JobConf conf = new JobConf();

            conf.Set(MRJobConfig.MrJobEndRetryAttempts, "0");
            conf.Set(MRJobConfig.MrJobEndNotificationMaxAttempts, "1");
            conf.Set(MRJobConfig.MrJobEndNotificationUrl, "http://nonexistent");
            conf.Set(MRJobConfig.MrJobEndRetryInterval, "5000");
            conf.Set(MRJobConfig.MrJobEndNotificationMaxRetryInterval, "5000");
            JobReport jobReport = Org.Mockito.Mockito.Mock <JobReport>();
            long      startTime = Runtime.CurrentTimeMillis();

            this.notificationCount = 0;
            this.SetConf(conf);
            this.Notify(jobReport);
            long endTime = Runtime.CurrentTimeMillis();

            NUnit.Framework.Assert.AreEqual("Only 1 try was expected but was : " + this.notificationCount
                                            , 1, this.notificationCount);
            NUnit.Framework.Assert.IsTrue("Should have taken more than 5 seconds it took " +
                                          (endTime - startTime), endTime - startTime > 5000);
            conf.Set(MRJobConfig.MrJobEndNotificationMaxAttempts, "3");
            conf.Set(MRJobConfig.MrJobEndRetryAttempts, "3");
            conf.Set(MRJobConfig.MrJobEndRetryInterval, "3000");
            conf.Set(MRJobConfig.MrJobEndNotificationMaxRetryInterval, "3000");
            startTime = Runtime.CurrentTimeMillis();
            this.notificationCount = 0;
            this.SetConf(conf);
            this.Notify(jobReport);
            endTime = Runtime.CurrentTimeMillis();
            NUnit.Framework.Assert.AreEqual("Only 3 retries were expected but was : " + this.
                                            notificationCount, 3, this.notificationCount);
            NUnit.Framework.Assert.IsTrue("Should have taken more than 9 seconds it took " +
                                          (endTime - startTime), endTime - startTime > 9000);
        }
Esempio n. 8
0
        public TestOutcome CreateRequest()
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Request";
            outcome.methodName = "RequestCreateJob";
            try
            {
                RequestsApi requestsApi = new RequestsApi(_url);
                Request     request     = RequestGenerator.GetSimpleRequest();
                JobReport   job         = requestsApi.RequestCreateJob(_session.SessionId, "all", request);

                JobReport polledJob = JobHandler.pollJob(job, _session.SessionId, _url);
                if (polledJob.ErrorMessage != null)
                {
                    outcome.outcome = polledJob.ErrorMessage;
                }
                else
                {
                    outcome.outcome = "Success";
                }
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }
Esempio n. 9
0
        public static Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job NewJob(ApplicationId appID
                                                                        , int i, int n, int m, Path confFile, bool hasFailedTasks)
        {
            JobId     id     = NewJobID(appID, i);
            string    name   = NewJobName();
            JobReport report = NewJobReport(id);
            IDictionary <TaskId, Task> tasks = NewTasks(id, n, m, hasFailedTasks);

            MockJobs.TaskCount taskCount = GetTaskCount(tasks.Values);
            Counters           counters  = GetCounters(tasks.Values);
            Path configFile = confFile;
            IDictionary <JobACL, AccessControlList> tmpJobACLs = new Dictionary <JobACL, AccessControlList
                                                                                 >();
            Configuration conf = new Configuration();

            conf.Set(JobACL.ViewJob.GetAclName(), "testuser");
            conf.SetBoolean(MRConfig.MrAclsEnabled, true);
            JobACLsManager aclsManager = new JobACLsManager(conf);

            tmpJobACLs = aclsManager.ConstructJobACLs(conf);
            IDictionary <JobACL, AccessControlList> jobACLs = tmpJobACLs;

            return(new _Job_503(id, name, report, counters, tasks, taskCount, configFile, jobACLs
                                , conf));
        }
        /* Verify some expected values based on the history file */
        /// <exception cref="System.Exception"/>
        public virtual void TestCompletedJob()
        {
            HistoryFileManager.HistoryFileInfo info = Org.Mockito.Mockito.Mock <HistoryFileManager.HistoryFileInfo
                                                                                >();
            Org.Mockito.Mockito.When(info.GetConfFile()).ThenReturn(fullConfPath);
            //Re-initialize to verify the delayed load.
            completedJob = new CompletedJob(conf, jobId, fullHistoryPath, loadTasks, "user",
                                            info, jobAclsManager);
            //Verify tasks loaded based on loadTask parameter.
            NUnit.Framework.Assert.AreEqual(loadTasks, completedJob.tasksLoaded.Get());
            NUnit.Framework.Assert.AreEqual(1, completedJob.GetAMInfos().Count);
            NUnit.Framework.Assert.AreEqual(10, completedJob.GetCompletedMaps());
            NUnit.Framework.Assert.AreEqual(1, completedJob.GetCompletedReduces());
            NUnit.Framework.Assert.AreEqual(12, completedJob.GetTasks().Count);
            //Verify tasks loaded at this point.
            NUnit.Framework.Assert.AreEqual(true, completedJob.tasksLoaded.Get());
            NUnit.Framework.Assert.AreEqual(10, completedJob.GetTasks(TaskType.Map).Count);
            NUnit.Framework.Assert.AreEqual(2, completedJob.GetTasks(TaskType.Reduce).Count);
            NUnit.Framework.Assert.AreEqual("user", completedJob.GetUserName());
            NUnit.Framework.Assert.AreEqual(JobState.Succeeded, completedJob.GetState());
            JobReport jobReport = completedJob.GetReport();

            NUnit.Framework.Assert.AreEqual("user", jobReport.GetUser());
            NUnit.Framework.Assert.AreEqual(JobState.Succeeded, jobReport.GetJobState());
        }
Esempio n. 11
0
 /// <exception cref="System.IO.IOException"/>
 private static MockHistoryJobs.JobsPair Split(IDictionary <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                                            > mocked)
 {
     MockHistoryJobs.JobsPair ret = new MockHistoryJobs.JobsPair();
     ret.full    = Maps.NewHashMap();
     ret.partial = Maps.NewHashMap();
     foreach (KeyValuePair <JobId, Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job> entry in
              mocked)
     {
         JobId id = entry.Key;
         Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job j       = entry.Value;
         MockHistoryJobs.MockCompletedJob           mockJob = new MockHistoryJobs.MockCompletedJob(j
                                                                                                   );
         // use MockCompletedJob to set everything below to make sure
         // consistent with what history server would do
         ret.full[id] = mockJob;
         JobReport    report = mockJob.GetReport();
         JobIndexInfo info   = new JobIndexInfo(report.GetStartTime(), report.GetFinishTime(
                                                    ), mockJob.GetUserName(), mockJob.GetName(), id, mockJob.GetCompletedMaps(), mockJob
                                                .GetCompletedReduces(), mockJob.GetState().ToString());
         info.SetJobStartTime(report.GetStartTime());
         info.SetQueueName(mockJob.GetQueueName());
         ret.partial[id] = new PartialJob(info, id);
     }
     return(ret);
 }
Esempio n. 12
0
        // acls not being checked since
        // we are using mock job instead of CompletedJob
        public static void VerifyHsJobGeneric(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job
                                              job, string id, string user, string name, string state, string queue, long startTime
                                              , long finishTime, int mapsTotal, int mapsCompleted, int reducesTotal, int reducesCompleted
                                              )
        {
            JobReport report = job.GetReport();

            WebServicesTestUtils.CheckStringMatch("id", MRApps.ToString(job.GetID()), id);
            WebServicesTestUtils.CheckStringMatch("user", job.GetUserName().ToString(), user);
            WebServicesTestUtils.CheckStringMatch("name", job.GetName(), name);
            WebServicesTestUtils.CheckStringMatch("state", job.GetState().ToString(), state);
            WebServicesTestUtils.CheckStringMatch("queue", job.GetQueueName(), queue);
            NUnit.Framework.Assert.AreEqual("startTime incorrect", report.GetStartTime(), startTime
                                            );
            NUnit.Framework.Assert.AreEqual("finishTime incorrect", report.GetFinishTime(), finishTime
                                            );
            NUnit.Framework.Assert.AreEqual("mapsTotal incorrect", job.GetTotalMaps(), mapsTotal
                                            );
            NUnit.Framework.Assert.AreEqual("mapsCompleted incorrect", job.GetCompletedMaps()
                                            , mapsCompleted);
            NUnit.Framework.Assert.AreEqual("reducesTotal incorrect", job.GetTotalReduces(),
                                            reducesTotal);
            NUnit.Framework.Assert.AreEqual("reducesCompleted incorrect", job.GetCompletedReduces
                                                (), reducesCompleted);
        }
Esempio n. 13
0
        /// <summary>
        /// Gets the JobReport with the specified id
        /// </summary>
        /// <param name="id">The id of the Job</param>
        /// <returns></returns>
        public async Task <JobReport> GetJobReportAsync(int id)
        {
            using IServiceScope scope = _serviceScopeFactory.CreateScope();
            ApplicationDbContext db     = scope.ServiceProvider.GetService <ApplicationDbContext>();
            JobReport            report = await db.JobReports.FirstOrDefaultAsync(x => x.Id == id);

            return(report);
        }
 public void ImportJobOnFatalException(JobReport jobReport)
 {
     Console.Error.WriteLine(jobReport.FatalException);
     foreach (var errorRow in jobReport.ErrorRows)
     {
         Console.Error.WriteLine(errorRow);
     }
 }
 public virtual void SetJobReport(JobReport jobReport)
 {
     MaybeInitBuilder();
     if (jobReport == null)
     {
         builder.ClearJobReport();
     }
     this.jobReport = jobReport;
 }
Esempio n. 16
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="System.Exception"/>
        /// <exception cref="Org.Apache.Avro.AvroRemoteException"/>
        /// <exception cref="System.TypeLoadException"/>
        public virtual void TestJobHistoryData()
        {
            if (!(new FilePath(MiniMRYarnCluster.Appjar)).Exists())
            {
                Log.Info("MRAppJar " + MiniMRYarnCluster.Appjar + " not found. Not running test."
                         );
                return;
            }
            SleepJob sleepJob = new SleepJob();

            sleepJob.SetConf(mrCluster.GetConfig());
            // Job with 3 maps and 2 reduces
            Job job = sleepJob.CreateJob(3, 2, 1000, 1, 500, 1);

            job.SetJarByClass(typeof(SleepJob));
            job.AddFileToClassPath(AppJar);
            // The AppMaster jar itself.
            job.WaitForCompletion(true);
            Counters      counterMR   = job.GetCounters();
            JobId         jobId       = TypeConverter.ToYarn(job.GetJobID());
            ApplicationId appID       = jobId.GetAppId();
            int           pollElapsed = 0;

            while (true)
            {
                Sharpen.Thread.Sleep(1000);
                pollElapsed += 1000;
                if (TerminalRmAppStates.Contains(mrCluster.GetResourceManager().GetRMContext().GetRMApps
                                                     ()[appID].GetState()))
                {
                    break;
                }
                if (pollElapsed >= 60000)
                {
                    Log.Warn("application did not reach terminal state within 60 seconds");
                    break;
                }
            }
            NUnit.Framework.Assert.AreEqual(RMAppState.Finished, mrCluster.GetResourceManager
                                                ().GetRMContext().GetRMApps()[appID].GetState());
            Counters counterHS = job.GetCounters();

            //TODO the Assert below worked. need to check
            //Should we compare each field or convert to V2 counter and compare
            Log.Info("CounterHS " + counterHS);
            Log.Info("CounterMR " + counterMR);
            NUnit.Framework.Assert.AreEqual(counterHS, counterMR);
            HSClientProtocol    historyClient = InstantiateHistoryProxy();
            GetJobReportRequest gjReq         = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <GetJobReportRequest
                                                                                               >();

            gjReq.SetJobId(jobId);
            JobReport jobReport = historyClient.GetJobReport(gjReq).GetJobReport();

            VerifyJobReport(jobReport, jobId);
        }
 protected void ImportJobOnComplete(JobReport jobReport)
 {
     this.context.PublishCompleted(
         jobReport.FileBytes,
         jobReport.MetadataBytes,
         jobReport.TotalRows,
         jobReport.ErrorRowCount,
         jobReport.StartTime,
         jobReport.EndTime);
 }
Esempio n. 18
0
        public async Task <IActionResult> GetReportJob([FromQuery] JobReport jsReport)
        {
            var result = await repo.GetJobReport(jsReport);

            if (result != null)
            {
                return(Ok(result));
            }

            return(BadRequest("Error in saving employee"));
        }
Esempio n. 19
0
 public JobReportDto MapGetJobReportDto(JobReport entity)
 {
     return(new JobReportDto
     {
         Id = entity.Id,
         UserId = entity.UserId,
         JobId = entity.JobId,
         Created = entity.Created,
         Text = entity.Text
     });
 }
 protected void ImportJobOnFatalException(JobReport jobReport)
 {
     this.context.PublishFatalException(
         jobReport.FatalException,
         jobReport.FileBytes,
         jobReport.MetadataBytes,
         jobReport.TotalRows,
         jobReport.ErrorRowCount,
         jobReport.StartTime,
         jobReport.EndTime);
 }
Esempio n. 21
0
 public PartialJob(JobIndexInfo jobIndexInfo, JobId jobId)
 {
     this.jobIndexInfo = jobIndexInfo;
     this.jobId        = jobId;
     jobReport         = RecordFactoryProvider.GetRecordFactory(null).NewRecordInstance <JobReport
                                                                                         >();
     jobReport.SetSubmitTime(jobIndexInfo.GetSubmitTime());
     jobReport.SetStartTime(jobIndexInfo.GetJobStartTime());
     jobReport.SetFinishTime(jobIndexInfo.GetFinishTime());
     jobReport.SetJobState(GetState());
 }
Esempio n. 22
0
        public async Task <ActionResult <JobReport> > Put(int id, [FromBody] JobReport value)
        {
            if (value == null)
            {
                return(BadRequest());
            }

            JobReport job = await _jobReports.EditJobReportAsync(id, value);

            return(job != null?Ok(job) : (ActionResult <JobReport>)NotFound());
        }
Esempio n. 23
0
        public JobInfo(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job)
        {
            this.id = MRApps.ToString(job.GetID());
            JobReport report = job.GetReport();

            this.mapsTotal        = job.GetTotalMaps();
            this.mapsCompleted    = job.GetCompletedMaps();
            this.reducesTotal     = job.GetTotalReduces();
            this.reducesCompleted = job.GetCompletedReduces();
            this.submitTime       = report.GetSubmitTime();
            this.startTime        = report.GetStartTime();
            this.finishTime       = report.GetFinishTime();
            this.name             = job.GetName().ToString();
            this.queue            = job.GetQueueName();
            this.user             = job.GetUserName();
            this.state            = job.GetState().ToString();
            this.acls             = new AList <ConfEntryInfo>();
            if (job is CompletedJob)
            {
                avgMapTime               = 0l;
                avgReduceTime            = 0l;
                avgShuffleTime           = 0l;
                avgMergeTime             = 0l;
                failedReduceAttempts     = 0;
                killedReduceAttempts     = 0;
                successfulReduceAttempts = 0;
                failedMapAttempts        = 0;
                killedMapAttempts        = 0;
                successfulMapAttempts    = 0;
                CountTasksAndAttempts(job);
                this.uberized    = job.IsUber();
                this.diagnostics = string.Empty;
                IList <string> diagnostics = job.GetDiagnostics();
                if (diagnostics != null && !diagnostics.IsEmpty())
                {
                    StringBuilder b = new StringBuilder();
                    foreach (string diag in diagnostics)
                    {
                        b.Append(diag);
                    }
                    this.diagnostics = b.ToString();
                }
                IDictionary <JobACL, AccessControlList> allacls = job.GetJobACLs();
                if (allacls != null)
                {
                    foreach (KeyValuePair <JobACL, AccessControlList> entry in allacls)
                    {
                        this.acls.AddItem(new ConfEntryInfo(entry.Key.GetAclName(), entry.Value.GetAclString
                                                                ()));
                    }
                }
            }
        }
Esempio n. 24
0
        public JobInfo(Org.Apache.Hadoop.Mapreduce.V2.App.Job.Job job, bool hasAccess)
        {
            // ok for any user to see
            // these should only be seen if acls allow
            this.id = MRApps.ToString(job.GetID());
            JobReport report = job.GetReport();

            this.startTime   = report.GetStartTime();
            this.finishTime  = report.GetFinishTime();
            this.elapsedTime = Times.Elapsed(this.startTime, this.finishTime);
            if (this.elapsedTime == -1)
            {
                this.elapsedTime = 0;
            }
            this.name                  = job.GetName().ToString();
            this.user                  = job.GetUserName();
            this.state                 = job.GetState();
            this.mapsTotal             = job.GetTotalMaps();
            this.mapsCompleted         = job.GetCompletedMaps();
            this.mapProgress           = report.GetMapProgress() * 100;
            this.mapProgressPercent    = StringHelper.Percent(report.GetMapProgress());
            this.reducesTotal          = job.GetTotalReduces();
            this.reducesCompleted      = job.GetCompletedReduces();
            this.reduceProgress        = report.GetReduceProgress() * 100;
            this.reduceProgressPercent = StringHelper.Percent(report.GetReduceProgress());
            this.acls                  = new AList <ConfEntryInfo>();
            if (hasAccess)
            {
                this.diagnostics = string.Empty;
                CountTasksAndAttempts(job);
                this.uberized = job.IsUber();
                IList <string> diagnostics = job.GetDiagnostics();
                if (diagnostics != null && !diagnostics.IsEmpty())
                {
                    StringBuilder b = new StringBuilder();
                    foreach (string diag in diagnostics)
                    {
                        b.Append(diag);
                    }
                    this.diagnostics = b.ToString();
                }
                IDictionary <JobACL, AccessControlList> allacls = job.GetJobACLs();
                if (allacls != null)
                {
                    foreach (KeyValuePair <JobACL, AccessControlList> entry in allacls)
                    {
                        this.acls.AddItem(new ConfEntryInfo(entry.Key.GetAclName(), entry.Value.GetAclString
                                                                ()));
                    }
                }
            }
        }
Esempio n. 25
0
        public static JobStatus FromYarn(JobReport jobreport, string trackingUrl)
        {
            JobPriority jobPriority = JobPriority.Normal;
            JobStatus   jobStatus   = new JobStatus(FromYarn(jobreport.GetJobId()), jobreport.GetSetupProgress
                                                        (), jobreport.GetMapProgress(), jobreport.GetReduceProgress(), jobreport.GetCleanupProgress
                                                        (), FromYarn(jobreport.GetJobState()), jobPriority, jobreport.GetUser(), jobreport
                                                    .GetJobName(), jobreport.GetJobFile(), trackingUrl, jobreport.IsUber());

            jobStatus.SetStartTime(jobreport.GetStartTime());
            jobStatus.SetFinishTime(jobreport.GetFinishTime());
            jobStatus.SetFailureInfo(jobreport.GetDiagnostics());
            return(jobStatus);
        }
Esempio n. 26
0
        public static JobReport NewJobReport(JobId id)
        {
            JobReport report = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <JobReport>();

            report.SetJobId(id);
            report.SetSubmitTime(Runtime.CurrentTimeMillis() - Dt);
            report.SetStartTime(Runtime.CurrentTimeMillis() - (int)(Math.Random() * Dt));
            report.SetFinishTime(Runtime.CurrentTimeMillis() + (int)(Math.Random() * Dt) + 1);
            report.SetMapProgress((float)Math.Random());
            report.SetReduceProgress((float)Math.Random());
            report.SetJobState(JobStates.Next());
            return(report);
        }
Esempio n. 27
0
        private Org.Apache.Hadoop.Mapreduce.V2.Api.Protocolrecords.GetJobReportResponse GetJobReportResponse
            ()
        {
            Org.Apache.Hadoop.Mapreduce.V2.Api.Protocolrecords.GetJobReportResponse jobReportResponse
                = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <Org.Apache.Hadoop.Mapreduce.V2.Api.Protocolrecords.GetJobReportResponse
                                                                 >();
            JobReport jobReport = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <JobReport>();

            jobReport.SetJobId(jobId);
            jobReport.SetJobState(JobState.Succeeded);
            jobReportResponse.SetJobReport(jobReport);
            return(jobReportResponse);
        }
Esempio n. 28
0
        public static JobReport pollJob(JobReport job, string sessionId, string url)
        {
            JobsApi   jobsApi = new JobsApi(url);
            JobReport polledJob;

            do
            {
                Thread.Sleep(1000);
                polledJob = jobsApi.JobGet(sessionId, job.Id);
                Console.WriteLine(polledJob.Status);
            } while (polledJob.Status != "error" && polledJob.Status != "finished");
            return(polledJob);
        }
Esempio n. 29
0
 public _Job_503(JobId id, string name, JobReport report, Counters counters, IDictionary
                 <TaskId, Task> tasks, MockJobs.TaskCount taskCount, Path configFile, IDictionary
                 <JobACL, AccessControlList> jobACLs, Configuration conf)
 {
     this.id         = id;
     this.name       = name;
     this.report     = report;
     this.counters   = counters;
     this.tasks      = tasks;
     this.taskCount  = taskCount;
     this.configFile = configFile;
     this.jobACLs    = jobACLs;
     this.conf       = conf;
 }
 public virtual JobReport GetJobReport()
 {
     MRServiceProtos.GetJobReportResponseProtoOrBuilder p = viaProto ? proto : builder;
     if (this.jobReport != null)
     {
         return(this.jobReport);
     }
     if (!p.HasJobReport())
     {
         return(null);
     }
     this.jobReport = ConvertFromProtoFormat(p.GetJobReport());
     return(this.jobReport);
 }