コード例 #1
0
        /// <summary>
        /// Submit job.
        /// </summary>
        /// <param name="job">Job to submit.</param>
        public void Submit(Job job)
        {
            if (job == null)
            {
                throw new ArgumentNullException("job");
            }

            XmlDocument dom = new XmlDocument();
            XmlElement ele = dom.CreateElement(MessageType.JobManage.ToString());
            ele.SetAttribute("command", CommandType.JobSubmit.ToString());

            string jobXml = job.ToXml();
            ele.InnerXml = jobXml;

            ProcessNode.SendMessage(_udpSender, ele.OuterXml, ServerIP, ServerPort);
        }
コード例 #2
0
        /// <summary>
        /// Dispose job.
        /// </summary>
        /// <param name="job">Job to dispose.</param>
        protected override void DispatchJob(Job job)
        {
            // dead lock while _toScheduleJobs with ((IProcessNode)this).Nodes
            lock (((IProcessNode)this).Nodes)
            {
                NodeInfo ci = FindMaxCapabilityNode(((IProcessNode)this).Nodes, job);

                if (ci != null && !ci.Busy && ci.NodeType == NodeType.Execution)
                {
                    Console.WriteLine("{0} Dispatch job {1} out to {2}",
                        DateTime.Now.ToLongTimeString(), Path.GetFileName(job.Name),
                        ci.ToString());

                    string message = job.ToXml();
                    SendUdpMessage(message, ci.IP, ci.Port);
                    job.Status = JobStatus.Dispatched;
                    ci.Busy = true;
                }
            }
        }