/// <summary> /// Refreshes job status /// </summary> public void RefreshJobStatus() { if (_jobListener != null) { LogEntry oldVersion = (LogEntry)this.MemberwiseClone(); JobState = _jobListener.JobState; ISchedulerJobCounters counters = _jobListener.JobCounters; //_job.GetCounters(); string stateStr = string.Format("{0}/{1}/{2}/{3}/{4}", counters.QueuedTaskCount, counters.RunningTaskCount, counters.FailedTaskCount, counters.CanceledTaskCount, counters.FinishedTaskCount); FailedTaskCount = counters.FailedTaskCount; TaskStatus = stateStr; if (FailedTaskCount > 0) { IEnumerable <ISchedulerTask> tasklist = ClusterSubmitter.GetFailedAndCanceledTasks(_jobListener.Scheduler, _jobListener.Job); string failedTaskRangeAsString = tasklist.Select(task => task.TaskId.JobTaskId).StringJoin(","); if ("" != failedTaskRangeAsString) { this.FailedTasks = RangeCollection.Parse(failedTaskRangeAsString).ToString(); } else { FailedTasks = ""; } } else { FailedTasks = ""; } if (_jobListener.JobState == JobState.Finished) { if (WallTime.Ticks == 0) { DateTime startTime = _job.SubmitTime; DateTime endTime = _job.EndTime; WallTime = endTime - startTime; } if (CpuTime.Ticks == 0) { var tasklist = _job.GetTaskList(null, null, true).Cast <ISchedulerTask>(); var totalTicks = tasklist.Select(task => (task.EndTime - task.StartTime).Ticks).Sum(); CpuTime = new TimeSpan(totalTicks); } } } }
private void UpdateFailedTaskString(ISchedulerJob job) { IEnumerable <ISchedulerTask> tasklist = ClusterSubmitter.GetFailedAndCanceledTasks(_jobListener.Scheduler, job); this.FailedTasks = tasklist.Select(task => task.TaskId.JobTaskId).StringJoin(","); }