Пример #1
0
        public static bool ExecuteSteps()
        {
            if (IgorAssert.HasJobFailed())
            {
                IgorDebug.CoreLogError("Job failed so we are bailing out early and not finishing the remaining steps!");

                return(false);
            }

            List <StepID> SortedSteps = new List <StepID>(JobSteps.Keys);

            SortedSteps.Sort();

            IgorJobConfig.SetIsRunning(true);

            int StartingPriority        = IgorJobConfig.GetLastPriority();
            int StartingIndexInPriority = IgorJobConfig.GetLastIndexInPriority();

            foreach (StepID CurrentStep in SortedSteps)
            {
                if (CurrentStep.StepPriority > StartingPriority)
                {
                    IgorJobConfig.SetLastPriority(CurrentStep.StepPriority - 1);

                    int LastIndex = 0;

                    List <JobStep> CurrentStepFuncs = JobSteps[CurrentStep];

                    foreach (JobStep CurrentFunction in CurrentStepFuncs)
                    {
                        if (LastIndex > StartingIndexInPriority)
                        {
                            if (CurrentFunction.StepFunction())
                            {
                                IgorJobConfig.SetLastIndexInPriority(LastIndex);
                            }

                            return(false);
                        }

                        ++LastIndex;
                    }

                    StartingIndexInPriority = -1;
                    IgorJobConfig.SetLastIndexInPriority(-1);
                }
            }

            return(true);
        }
Пример #2
0
        public static void SetJobToRunByName(string JobName)
        {
            IgorConfig Inst = GetInstance();

            if (Inst != null)
            {
                foreach (IgorPersistentJobConfig CurrentJob in Inst.JobConfigs)
                {
                    if (CurrentJob.JobName == JobName)
                    {
                        IgorJobConfig NewConfig = new IgorJobConfig();

                        NewConfig.Persistent = CurrentJob;

                        NewConfig.Save(IgorJobConfig.IgorJobConfigPath);

                        IgorJobConfig.SetLastPriority(-1);
                        IgorJobConfig.SetLastIndexInPriority(-1);

                        return;
                    }
                }
            }
        }