static void RunAndDownload(SfbClient _net, string shortName, string directoryName, JobEntry je) { je.RunAndDownloadIsActive = true; string errortext = null; _net.Run(je.filetype, shortName, je, ref errortext); if (errortext == "Maximum number of concurrent jobs exceeded.") { _net.Disconnect(); je.WriteToLog(errortext.ToLower()); je.SetStatus(Status.schedulerequest); } else if (errortext != null) { _net.Disconnect(); MessageBoxShow(je._houston, errortext, "Run error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { _net.GetFinalStatus(); je.SetCpuAndMem(); _net.Download(je.DirectoryName); //je.WriteToLog("downloading finished"); _net.Disconnect(); if (je.stat == Status.aborted) { je.WriteToLog("abort completed"); } } }
public static void InvokedTimerTick(Object obj) { JobEntry je = (JobEntry)obj; try { if (je._job != null) { int id = je._job.Id; //Test if the process exists. je._job.Refresh(); if (!je._job.HasExited) { System.TimeSpan diff1 = DateTime.Now.Subtract(je._job.StartTime); //je.SubItems[(int)Display.cpu].Text = diff1.TotalSeconds.ToString("#0.0")+"s"; je.SubItems[(int)Display.cpu].Text = je._job.TotalProcessorTime.TotalSeconds.ToString("#0.0") + "s"; je.SubItems[(int)Display.mem].Text = (1 + je._job.WorkingSet64 / 1024).ToString("n0") + "kb"; } } else if (je._net != null) { je.SetCpuAndMem(); } } catch //This might be a _net job { if (je._net != null) { } } if (je.stat == Status.scheduled && DateTime.Compare(DateTime.Now, je._schedTime) > 0) { je.SetStatus(Status.queued); } else if (je.stat == Status.rscheduled && DateTime.Compare(DateTime.Now, je._schedTime) > 0) { je.SetStatus(Status.rqueued); } }