Exemplo n.º 1
0
        public void Keepalive(string jsondata)
        {
            var jr = new JsonReader(jsondata);
            var jx = jr.Deserialize();
            var jo = jx as Dictionary<string, object>;
            if (jo == null)
                return;

            var url = jo["url"].ToString();

            var w = GetWorkerByUrl(url);
            if (w != null)
            {
                w.LastKeepalive = DateTime.Now;
                if (w.State == WorkerState.Dead)
                    w.State = WorkerState.Idle;
                return;
            }

            Console.WriteLine("ManagerJobController: Keepalive from new worker: " + url);
            w = new WorkerInfo();
            w.URL = url;
            w.LastKeepalive = DateTime.Now;
            if (w.State == WorkerState.Dead)
                w.State = WorkerState.Idle;
            m_workers.Add(w);
        }
Exemplo n.º 2
0
 public void StartupWorker(WorkerInfo w)
 {
     var wc = new WebClient();
     foreach (var a in Assemblies.Keys)
     {
         Console.WriteLine("To " + w.URL);
         wc.UploadData(Utilities.CombineURL(w.URL, "/job/" + w.RemoteJobId + "/assemblies?name=" + a), Assemblies[a]);
     }
     // upload all assemblies
     var u = Utilities.CombineURL(w.URL, "/job/" + w.RemoteJobId + "/start");
     wc.DownloadString(u);
     w.State = WorkerState.JobRunning;
     w.StartTime = DateTime.Now;
 }