public static void CompleteTest() { RenderViewModel renderDataa = new RenderViewModel() { RawFileNames = "helke1.mp4,helke2.mp4", ConvertedFileName = "Helke320TestWithNoSlate.mp4", Duration = 0, Start = 0, FirstName = "Shane", LastName = "White", FoundVideoToRender = true, FuneralHomeName = "DevHome", ServiceId = 40, VideoQueId = 30, VideoQueType = VideoQueType.FullNoSlate, ServiceDate = DateTime.Now }; RenderVideo render = new RenderVideo(renderDataa); render.StartRender(false); }
private void timer1_Tick(object sender, ElapsedEventArgs e) { var isAzureVM = ConfigurationManager.AppSettings["IsAzureVM"]; if (isAzureVM != "false") { //Each tick represents 30 seconds //Dont keep track of ticks on Machine that is always running ticks++; } string vmMachineName = Environment.MachineName; DataAccess da = new DataAccess(); if (GlobalVariables.IsRendering == false) { GlobalVariables.IsRendering = true; RenderViewModel renderData = da.GetRenderData(vmMachineName); if (renderData != null && renderData.FoundVideoToRender == true) { RenderVideo render = new RenderVideo(renderData); switch (renderData.VideoQueType) { case VideoQueType.FullNoSlate: render.StartRender(false); break; case VideoQueType.FullWithSlate: render.StartRender(true); break; case VideoQueType.AddSlate: render.AddSlate(); break; case VideoQueType.StripSlate: render.RemoveSlate(); break; case VideoQueType.ReEditSlate: render.EditSlate(); break; } } else { GlobalVariables.IsRendering = false; } } if (GlobalVariables.IsRendering == false && isAzureVM != "false") { //If the machine has been running for 20 minutes and isn't rendering something probably isn't right if (ticks == 40) { Library.WriteServiceLog("Machine has been running for 40 ticks. Sending an email to Shane"); da.SendErrorEmail("Render Machine: " + vmMachineName + " has been running for 20 minutes and has not begun to process the video. "); } if (ticks > 65) { Library.WriteServiceLog("Machine has been running for " + ticks + " without starting render process"); //Only send an email every 13 times so we don't blow through our email alloment if this runs for a while. if (ticks % 13 == 0) { da.SendErrorEmail("Render Machine: " + vmMachineName + " has been running for longer than 30 minutes and has not begun to process the video. Attempting to Shut Down machine"); } Library.WriteServiceLog("Attempting to shut down machine"); string rg = da.GetResourceGroupName(vmMachineName); ManageResourceGroup.StopVirtualMachine(rg, vmMachineName); } } //The machine should never be alive this long if (ticks == 960) { Library.WriteServiceLog("Machine has been running for 960 ticks. Sending an email to Shane"); da.SendErrorEmail("Render Machine: " + vmMachineName + " has been running for over 8 hours "); } if (ticks > 1000) { Library.WriteServiceLog("Machine has been running for " + ticks); //Only send an email every 25 times so we don't blow through our email alloment if this runs for a while. if (ticks % 50 == 0) { da.SendErrorEmail("Render Machine: " + vmMachineName + " has been running for longer than 8 hours. Attempting to Shut Down machine"); } Library.WriteServiceLog("Attempting to shut down machine"); string rg = da.GetResourceGroupName(vmMachineName); ManageResourceGroup.StopVirtualMachine(rg, vmMachineName); } }