Пример #1
0
        public override void Start()
        {
            var taskCount = TaskDataHandler.GetDeadTaskCount();

            AgentManager.Startup(HttpRuntime.BinDirectory, new AgentLogger(), taskCount == 0, "..\\" + TaskManagerBase.TASKMANAGEMENT_FOLDERNAME);
            Logger.WriteInformation(1, "LocalTaskManager AgentManager STARTED.");
        }
Пример #2
0
 private void DeadTaskTimerElapsed(object o)
 {
     if (TaskDataHandler.GetDeadTaskCount() > 0)
     {
         BroadcastMessage(null);
     }
 }
Пример #3
0
        public virtual void RegisterTask(string type, TaskPriority priority, string data)
        {
            var task = TaskDataHandler.RegisterTask(type, priority, data);

            if (task != null)
            {
                BroadcastMessage(task);
            }
        }
Пример #4
0
        public void TaskFinished(SnTaskResult taskResult)
        {
            Debug.WriteLine("#TaskManagerHub> TaskFinished received. Agent: {0}, taskId: {1}, code: {2}, error: {3}", taskResult.AgentName, taskResult.Task.Id, taskResult.ResultCode, taskResult.Error == null ? "" : taskResult.Error.Message);

            // remove the task from the database first
            TaskDataHandler.DeleteTask(taskResult.Task.Id);

            Debug.WriteLine("#TaskManagerHub>FinishTask: task#{0} has been deleted.", taskResult.Task.Id);

            // then call the finalizer
            TaskManagerBase.OnTaskFinished(taskResult);
        }
Пример #5
0
        public SnTask GetTask(string agentName, string[] capabilities)
        {
            Debug.WriteLine("#TaskManagerHub> MyHub1.GetTask called. agentName: {0}, capabilities: {1}", agentName, String.Join(", ", capabilities));

            try
            {
                var task = TaskDataHandler.GetNextAndLock(agentName, capabilities);

                Debug.WriteLine("#TaskManagerHub> TaskDataHandler.GetNextAndLock returned with: " + (task == null ? "null" : "task#" + task.Id.ToString()));
                return(task);
            }
            catch (Exception e)
            {
                Debug.WriteLine("#TaskManagerHub> ERROR: " + e.Message);
            }

            return(null);
        }
Пример #6
0
 public void RefreshLock(string agentName, int taskId)
 {
     TaskDataHandler.RefreshLock(taskId);
     Debug.WriteLine("#TaskManagerHub>RefreshLock: task#" + taskId + ", agent: " + agentName);
 }