Пример #1
0
        /// <summary>
        /// Returns the number of tasks that failed for reasons other than preemption
        /// </summary>
        /// <param name="schedulerJob"></param>
        /// <returns></returns>
        private int GetNonPreemptedFailedTaskCount(IScheduler scheduler, ISchedulerJob schedulerJob)
        {
            int ret = 0;

            try
            {
                // Filter by failed tasks that failed due to preemption
                IFilterCollection fc = scheduler.CreateFilterCollection();
                fc.Add(FilterOperator.NotEqual, TaskPropertyIds.FailureReason, FailureReason.Preempted);
                fc.Add(FilterOperator.Equal, TaskPropertyIds.State, TaskState.Failed);

                // Only return the task Ids
                IPropertyIdCollection propIds = new PropertyIdCollection();
                propIds.AddPropertyId(TaskPropertyIds.TaskId);

                using (ISchedulerRowSet failedTasks = schedulerJob.OpenTaskRowSet(propIds, fc, null, true))
                {
                    ret = failedTasks.GetCount();
                }
            }

            catch (Exception ex)
            {
                TraceHelper.TraceEvent(this.sessionid, TraceEventType.Warning, "[JobMonitorEntry] Failed to get non-preempted failed task count : {0}", ex);
            }

            return(ret);
        }