示例#1
0
        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 + "!");
            }
        }
示例#2
0
        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();
                }
            }
        }
示例#3
0
        public static void CommandLineRunJob()
        {
            IgorDebug.CoreLog("CommandLineRunJob invoked from command line.");

            IgorConfigWindow.OpenOrGetConfigWindow();

            EditorHandleJobStatus(IgorCore.RunJob());
        }
示例#4
0
        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...");
            }
        }
示例#5
0
        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);
            }
        }
示例#6
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);
        }