Esempio n. 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);
        }
Esempio n. 2
0
        /// <summary>
        /// Calculate the min and max value for the service job
        /// </summary>
        private void CalculateMinAndMax()
        {
            PropertyId[] propIds;
            PropertyRow  row;
            int          userMax, userMin;

            switch (this.schedulerJob.UnitType)
            {
            case JobUnitType.Node:
                userMax = this.schedulerJob.MaximumNumberOfNodes;
                userMin = this.schedulerJob.MinimumNumberOfNodes;
                propIds = new PropertyId[] { JobPropertyIds.ComputedMaxNodes, JobPropertyIds.ComputedMinNodes };
                break;

            case JobUnitType.Socket:
                userMax = this.schedulerJob.MaximumNumberOfSockets;
                userMin = this.schedulerJob.MinimumNumberOfSockets;
                propIds = new PropertyId[] { JobPropertyIds.ComputedMaxSockets, JobPropertyIds.ComputedMinSockets };
                break;

            default:
                userMax = this.schedulerJob.MaximumNumberOfCores;
                userMin = this.schedulerJob.MinimumNumberOfCores;
                propIds = new PropertyId[] { JobPropertyIds.ComputedMaxCores, JobPropertyIds.ComputedMinCores };
                break;
            }

            IFilterCollection filter = new FilterCollection();

            filter.Add(FilterOperator.Equal, JobPropertyIds.Id, this.schedulerJob.Id);

            IPropertyIdCollection property = new PropertyIdCollection();

            foreach (PropertyId pid in propIds)
            {
                property.AddPropertyId(pid);
            }

            using (ISchedulerRowSet set = this.scheduler.OpenJobRowSet(property, filter, null))
            {
                PropertyRow[] rows = set.GetRows(0, set.GetCount() - 1).Rows;
                Debug.Assert(rows.Length > 0);
                row = rows[0];
            }

            string callerName  = "[JobMonitorEntry.GetMinAndMax]";
            int    computedMax = (int)JobHelper.GetStorePropertyValue(row.Props[0], propIds[0], 0, callerName);
            int    computedMin = (int)JobHelper.GetStorePropertyValue(row.Props[1], propIds[1], 0, callerName);

            if (this.schedulerJob.CanShrink)
            {
                this.minUnits = this.schedulerJob.AutoCalculateMin ? computedMin : userMin;
            }
            else
            {
                this.minUnits = userMin;
            }

            if (this.schedulerJob.CanGrow)
            {
                this.maxUnits = this.schedulerJob.AutoCalculateMax ? computedMax : userMax;
            }
            else
            {
                this.maxUnits = userMax;
            }

            if (this.maxUnits < this.minUnits)
            {
                this.maxUnits = this.minUnits;
            }

            TraceHelper.TraceEvent(this.sessionid, TraceEventType.Information, "[JobMonitorEntry] MaxUnits = {0}, MinUnits = {1}", this.maxUnits, this.minUnits);
        }