public static void CheckForNamedJobFlag() { if (IgorJobConfig.IsStringParamSet(NamedJobFlag)) { string JobToStart = IgorJobConfig.GetStringParam(NamedJobFlag); foreach (IgorPersistentJobConfig Job in IgorConfig.GetInstance().JobConfigs) { if (Job.JobName == JobToStart) { IgorJobConfig ConfigInst = IgorJobConfig.GetConfig(); ConfigInst.Persistent = Job; ConfigInst.Save(IgorJobConfig.IgorJobConfigPath); IgorDebug.CoreLog("Starting named job " + JobToStart + "."); return; } } IgorDebug.CoreLogError("Couldn't find named job " + JobToStart + "!"); } }
public static void HandleJobStatus(IgorCore.JobReturnStatus Status) { if (Status.bDone) { if (IgorAssert.HasJobFailed()) { IgorDebug.CoreLogError("Job failed!"); } else { IgorDebug.CoreLog("Job's done!"); } } if (!Status.bWasStartedManually && (Status.bFailed || Status.bDone)) { if (Status.bFailed) { Application.Quit(); } else { Application.Quit(); } } }
public static void CommandLineRunJob() { IgorDebug.CoreLog("CommandLineRunJob invoked from command line."); IgorConfigWindow.OpenOrGetConfigWindow(); EditorHandleJobStatus(IgorCore.RunJob()); }
public static void UpdateAndRunJob() { IgorDebug.CoreLog("UpdateAndRunJob invoked from command line."); IgorJobConfig.SetBoolParam("updatebeforebuild", true); IgorConfigWindow.OpenOrGetConfigWindow(); bool DidUpdate = IgorUpdater.CheckForUpdates(false, false, true); if (!DidUpdate) { IgorDebug.CoreLog("Igor did not need to update, running job."); EditorHandleJobStatus(IgorCore.RunJob()); } else { IgorDebug.CoreLog("Igor needed to update, waiting for re-compile to run a job..."); } }
public static void EditorHandleJobStatus(IgorCore.JobReturnStatus Status) { if (Status.bDone) { if (IgorAssert.HasJobFailed()) { IgorDebug.CoreLogError("Job failed!"); } else { IgorDebug.CoreLog("Job's done!"); } float time = IgorUtils.PlayJobsDoneSound(); System.Threading.Thread t = new System.Threading.Thread(() => WaitToExit(time)); t.Start(); while (t.IsAlive) { } } if (Status.bFailed) { IgorJobConfig.SetIsRunning(false); if (!Status.bWasStartedManually) { EditorApplication.Exit(-1); } } if (!Status.bWasStartedManually && Status.bDone) { EditorApplication.Exit(0); } }
public static JobReturnStatus RunJob(bool bFromMenu = false) { bool bWasStartedManually = false; bool bThrewException = false; bool bDone = false; try { if (!IgorJobConfig.GetIsRunning()) { IgorDebug.CoreLog("Job is starting!"); IgorAssert.StartJob(); CheckForNamedJobFlag(); } if (IgorJobConfig.GetWasMenuTriggered()) { bWasStartedManually = true; } else { bWasStartedManually = bFromMenu; IgorJobConfig.SetWasMenuTriggered(bWasStartedManually); } if (!IgorJobConfig.GetIsRunning() || EnabledModules.Count == 0) { RegisterAllModules(); } if (!IgorJobConfig.GetIsRunning() || ActiveModulesForJob.Count == 0) { ProcessArgs(); } if (ExecuteSteps()) { IgorJobConfig.SetIsRunning(false); bDone = true; } } catch (Exception e) { IgorDebug.CoreLogError("Caught exception while running the job. Exception is " + (e == null ? "NULL exception!" : e.ToString() + (e.InnerException == null ? "\n\nNULL inner exception." : ("\n\nInner: " + e.InnerException.ToString())))); bThrewException = true; } finally { if (bThrewException || bDone) { Cleanup(); } } JobReturnStatus NewStatus = new JobReturnStatus(); NewStatus.bDone = bDone; NewStatus.bFailed = bThrewException || IgorAssert.HasJobFailed(); NewStatus.bWasStartedManually = bWasStartedManually; return(NewStatus); }