public void ProcessTask(TaskManager.TaskDetails oTask, out List <string> lsLogs, out string sOutput, out string sStatus)
        {
            // cast input values
            AdditionInput oInput = new AdditionInput();

            oInput = (AdditionInput)oDF.XmlStringToObject(oTask.InputValues, oInput);

            AdditionOutput oOutput = new AdditionOutput();

            // call processing algorithm
            oOutput.ValueSum = oInput.ValueA + oInput.ValueB;

            // submit results
            sOutput = oDF.ObjectToXmlString(oOutput);
            sStatus = "completed";
            lsLogs  = lsLog;
        }
예제 #2
0
        private void WorkerDoWork(object sender, DoWorkEventArgs e)
        {
            TaskManager.TaskDetails oTask = (TaskManager.TaskDetails)e.Argument;
            lsLog.Clear();

            try
            {
                string sOutput = "", sStatus = "";
                OptimizationAlgorithm oProcess = new OptimizationAlgorithm();
                oProcess.ProcessTask(oTask, out lsLog, out sOutput, out sStatus);

                string sLogs = oDF.ObjectToXmlString(lsLog);
                oTM.SubmitResult(oTask.TaskID, sOutput, sLogs, sStatus);
            }
            catch (Exception ex)
            {
                lsLog.Add("Exception:" + ex.Message);
                string sLogs = oDF.ObjectToXmlString(lsLog);
                oTM.SubmitResult(oTask.TaskID, null, sLogs, "failed");
            }
        }
예제 #3
0
 private void TimerTick(object sender, EventArgs e)
 {
     if (IsTaskServerActive())
     {
         // check for available tasks
         TaskManager.TaskDetails oTask = oTM.GetTask("AdditionBot01", "addition");
         if (oTask != null)
         {
             // if a task is available take it
             AddLogItem("Task Received : " + oTask.Name + ". Probing Stopped.");
             oTimer.Stop();
             oWorker.RunWorkerAsync(oTask);
         }
         else
         {
             AddLogItem("No Tasks Available. Probing will continue.");
         }
     }
     else
     {
         AddLogItem("Task Server InAccessible. Probing will continue.");
     }
 }