//virtual starting private void Experiment2() { vmlauncher = new VMLauncher(); vmlauncher.StopAll(20); steps = 2; workflows = 25; int sleep = 30; int delay = 140; var testpDescriptionReader = new DescriptionReader("testp.wf"); int i = 0; timer = new Timer(); timer.Elapsed += new ElapsedEventHandler((s, e) => { if (i >= workflows) { timer.Stop(); LogWrite("Pusher stopped"); } else { StringBuilder sb = new StringBuilder(); sb.Append(testpDescriptionReader.Script); if (i > 1) { steps = 1; } for (int step = 0; step < steps; step++) { sb.Append("\n step s" + step + " runs testp (\n in0=" + step + ",\n in1=" + sleep + ",\n timeToWait=" + (delay).ToString() + "\n)\n"); } _api.Script = sb.ToString(); jobMonitor = _api.CreateMonitor(); jobMonitor.UpdatePeriod = 1000 * 50; jobMonitor.Finished += JobMonitorOnFinishedExp2; jobMonitor.Active += JobMonitorOnActive; LogWrite(DateTime.Now.ToLongTimeString() + " " + (i + 1) + "/" + workflows + " testp pushed; " + steps + " steps"); jobMonitor.Run(); timer.Interval = sleep * 1000; } i++; }); LogWrite("Sending jobs to " + ConfigurationManager.AppSettings["ServerName"] + ". Press any key to stop monitoring..."); timer.Interval = 100; timer.Start(); vmlauncher.Run(); Console.ReadLine(); }
private void JobMonitorOnFinishedExp2(object sender, JobDecriptionEventArgs jobDecriptionEventArgs) { var monitor = (sender as JobMonitor); var jobInfo = jobDecriptionEventArgs.JobInfo; if (jobInfo == null) { return; } finished++; Console.WriteLine(jobInfo.FinishedAt.Value.ToLongTimeString() + " " + finished.ToString() + " finished Wf_ID: " + jobInfo.ID); if (finished == workflows && vmlauncher != null) { vmlauncher.StopAll(); } if (!IsErrorState(jobInfo) && monitor != null) { //monitor.DownloadResults(jobInfo); //Console.WriteLine(jobInfo.); } //Environment.Exit(0); }
//virtual starting private void Experiment2() { vmlauncher = new VMLauncher(); vmlauncher.StopAll(20); steps = 2; workflows = 25; int sleep = 30; int delay = 140; var testpDescriptionReader = new DescriptionReader("testp.wf"); int i = 0; timer = new Timer(); timer.Elapsed += new ElapsedEventHandler((s, e) => { if (i >= workflows) { timer.Stop(); LogWrite("Pusher stopped"); } else{ StringBuilder sb = new StringBuilder(); sb.Append(testpDescriptionReader.Script); if (i > 1) steps = 1; for (int step = 0; step < steps; step++) sb.Append("\n step s"+step+" runs testp (\n in0=" + step+",\n in1="+sleep+",\n timeToWait=" + (delay).ToString() + "\n)\n"); _api.Script = sb.ToString(); jobMonitor = _api.CreateMonitor(); jobMonitor.UpdatePeriod = 1000 * 50; jobMonitor.Finished += JobMonitorOnFinishedExp2; jobMonitor.Active += JobMonitorOnActive; LogWrite(DateTime.Now.ToLongTimeString() + " " + (i + 1) + "/" + workflows + " testp pushed; " + steps + " steps"); jobMonitor.Run(); timer.Interval = sleep*1000; } i++; }); LogWrite("Sending jobs to " + ConfigurationManager.AppSettings["ServerName"] + ". Press any key to stop monitoring..."); timer.Interval = 100; timer.Start(); vmlauncher.Run(); Console.ReadLine(); }