private bool VerifySubSchedulesDoNotLinkBackToParentSchedule( ScheduleId id, ISchedule schedule, Action <ScheduleIntegrityFailureType, IScheduleVertex> onValidationFailure) { bool result = true; schedule.TraverseAllScheduleVertices( schedule.Start, (node, edges) => { var scheduleNode = node as SubScheduleVertex; if (scheduleNode == null) { return(true); } var subScheduleId = scheduleNode.ScheduleToExecute; var isKnownSchedule = m_Schedules.Contains(subScheduleId); if (!isKnownSchedule) { result = false; onValidationFailure(ScheduleIntegrityFailureType.UnknownSubSchedule, node); return(false); } var doesSubScheduleLink = DoesSubScheduleLinkTo(id, m_Schedules.Schedule(subScheduleId)); if (doesSubScheduleLink) { result = false; onValidationFailure(ScheduleIntegrityFailureType.SubScheduleLinksBackToParentSchedule, node); } return(true); }); return(result); }
private IExecuteSchedules ExecuteInProcess( ScheduleId scheduleId, IEnumerable <IScheduleVariable> scheduleParameters, ScheduleExecutionInfo executionInfo) { // Translate the schedule to an executable schedule var editableSchedule = m_KnownSchedules.Schedule(scheduleId); // Create a new executor and provide it with the schedule var executor = m_LoadExecutor(editableSchedule, scheduleId, executionInfo); { // Attach to events. We want to remove the executor from the collection as soon as it's finished executor.OnFinish += HandleScheduleExecutionFinish; m_RunningExecutors.Add(new ExecutingScheduleKey(scheduleId, scheduleParameters), executor); executor.Start(scheduleParameters); } return(executor); }