private JobStatistic GetJobStatistic(JobInfo job) { double?pnSeconds = null; try { // for job that had been run less than 30 seconds, we don't count it now. if (job.TotalRunningTime.TotalSeconds < 1.0 || (job.TotalRunningTime.TotalSeconds < 30.0 && !IsJobStateFinal(job.State))) { return(null); } var jobStatistics = VC.GetJobStatistics(job.ID.ToString()); pnSeconds = jobStatistics.VertexStats.Take(1).Sum(v => v.TotalTimeCompleted.TotalSeconds); JobStatistic stat = new JobStatistic() { Id = job.ID, Name = job.Name, HyperLink = string.Format("{0}/_Jobs/{1}", _httpUrlOfVirtualCluster, job.ID), UserName = job.UserName, TrueUserName = GetTrueUserName(job), State = (int)job.State, SubmitTime = job.SubmitTime, StartTime = job.StartTime, EndTime = job.EndTime, TotalRunningTimeInSecond = (long?)job.TotalRunningTime.TotalSeconds, PNSeconds = (long?)pnSeconds, }; return(stat); } catch (Exception ex) { Console.WriteLine("Failed to get statistics for job. ID: {0}. Exception: {1}", job.ID, ex); Console.WriteLine("JobInfo: {0} {1} {2} {3} {4} {5} {6}", job.Name, job.UserName, job.State, job.SubmitTime, job.StartTime, job.TotalRunningTime, pnSeconds); } return(null); }