예제 #1
0
        public ComputeConnector(string uuid, string name, ServerConfiguration computeInfo)
        {
            UUID = uuid;
            Name = name;
            this.computeNodeInfo = computeInfo;
            serviceInterface = new ServiceInterface(computeNodeInfo.IpAddress, computeNodeInfo.Port);

            workers = new List<WorkerAdapter>();
            for (int i = 0; i < computeInfo.PoolSize; i++)
            {
                var workerInfo = new WorkerAdapter();
                workerInfo.Id = string.Format("Worker_{0}", i);
                workerInfo.Status = RunnerStatus.Idle;
                workerInfo.Connector = this;
                workers.Add(workerInfo);
            }
        }
예제 #2
0
 private void AsignNextTaskTo(WorkerAdapter worker)
 {
     var computation = todo.Dequeue();
     try
     {
         worker.StartComputation(computation);
     }
     catch (Exception ex)
     {
         todo.Enqueue(computation);
         Console.WriteLine("Could not perform calculation on {0}@{1} -- {2}", worker.Id, worker.Connector.Name, ex.Message);
     }
 }