Exemple #1
0
		public static Int32 CompareTasksByCost( AgentTask A, AgentTask B )
		{
			if( ( A.Specification != null ) &&
				( B.Specification != null ) )
			{
				return A.Specification.Cost.CompareTo( B.Specification.Cost );
			}
			return 0;
		}
Exemple #2
0
		public static Int32 CompareTasksByAssignTime( AgentTask A, AgentTask B )
		{
			return A.AssignTime.CompareTo( B.AssignTime );
		}
Exemple #3
0
		private void UpdateTaskStateAsRequeued( AgentTask RunningTask )
		{
			// A task is killed or rejected when a connection is closed and it still has
			// pending or running tasks assigned to it. Simply requeue the tasks for
			// another agent to pick up.

            RunningTask.StopTime = DateTime.UtcNow;
			RunningTasks.Remove( RunningTask.Specification.TaskGuid );
			RunningTask.CurrentOwner.RunningTasks.Remove( RunningTask.Specification.TaskGuid );

			// Update stats
			if( RunningTask.CurrentOwner is RemoteConnection )
			{
				TaskCountRemote--;
			}

			// Reset a couple states before requeueing
			RunningTask.CurrentState = new AgentTaskState( RunningTask.Specification.JobGuid, RunningTask.Specification.TaskGuid, EJobTaskState.TASK_STATE_IDLE );
			RunningTask.CurrentOwner = null;

			PendingTasks.Push( RunningTask );
			TaskCountRequeue++;

			// With the killed task requeued, check for reservations to see
			// if anyone else can take the task on right away
			CheckForReservations();
		}
Exemple #4
0
		private void UpdateTaskStateAsFailure( AgentTask RunningTask )
		{
			TaskFailureCount++;
            RunningTask.StopTime = DateTime.UtcNow;
			RunningTasks.Remove( RunningTask.Specification.TaskGuid );
			RunningTask.CurrentOwner.RunningTasks.Remove( RunningTask.Specification.TaskGuid );
			RetiredTasks.Enqueue( RunningTask );
		}