//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(); }
public static void RunVmAndInstallSoftware() { string vmAddress = "192.168.0.87"; int port = 22; string username = "******"; string password = "******"; string vmName = "ubu"; string installationDir = "/home/nano/installation"; //run ResourceBase //run ExecutionBroker //run ControllerFarmHost //run PackageInstallationService //run VBoxWebSrv.exe //run VMService //create mock for scheduler? var vm = VMLauncher.RunVM("ubu"); Thread.Sleep(30000); bool isRunning = Utility.IsMachineRunning(vmAddress); //make addtional actions string createDirectory = "cd /home/nano; rm -rf installation; mkdir installation;"; Utility.SshExec(vmAddress, port, username, password, createDirectory); Utility.InstallPackageToLinux(installationDir); Thread.Sleep(30000); bool isInstalled = Utility.IsPackageInstalled(vmAddress, installationDir); //create task and submit to clavire //remove package (optional) vm.Stop(); }
static void Debugging() { VMLauncher.RunVBox(); //VMLauncher.AddToResourceBase(); //VMLauncher.RemoveFromResourceBase(); }
//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(); }