Beispiel #1
0
        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);
        }
        /// <summary>
        /// Determines the most suitable execution location for the given schedule and then starts the execution in that location.
        /// </summary>
        /// <param name="scheduleId">The ID of the schedule that should be executed.</param>
        /// <param name="scheduleParameters">The collection of parameters that have to be provided to the schedule before executing.</param>
        /// <param name="executionInfo">The object that provides information about the schedule that is currently being executed.</param>
        /// <param name="executeOutOfProcess">A flag indicating if the schedule should be executed in another processor or not.</param>
        /// <returns>
        /// The token that is related to the execution of the given schedule.
        /// </returns>
        /// <remarks>
        /// For local schedules the cancellation token is checked regularly and the schedule execution is cancelled on request. For
        /// remote schedule execution setting the cancellation token means that a termination signal is send to the remote
        /// application.
        /// </remarks>
        public IExecuteSchedules Execute(
            ScheduleId scheduleId,
            IEnumerable <IScheduleVariable> scheduleParameters = null,
            ScheduleExecutionInfo executionInfo = null,
            bool executeOutOfProcess            = false)
        {
            lock (m_Lock)
            {
                if (!m_KnownSchedules.Contains(scheduleId))
                {
                    throw new UnknownScheduleException();
                }

                var key = new ExecutingScheduleKey(scheduleId, scheduleParameters);
                if (m_RunningExecutors.ContainsKey(key))
                {
                    return(m_RunningExecutors[key]);
                }

                if (executeOutOfProcess)
                {
                    // Determine what data needs to be serialized for schedule to execute
                    // Serialize all data + components + schedules
                    // Start external app
                    // Feed data stream of data + components + schedules
                    // Indicate which schedule should be executed + parameters
                    // Start
                    // Return distributed schedule executor
                    // --> This is all based on a set of components that can handle all kinds of distribution methods / desires
                    //     For instance we eventually also want to do Domain Decomp this way.
                    throw new NotImplementedException();
                }
                else
                {
                    return(ExecuteInProcess(scheduleId, scheduleParameters, executionInfo));
                }
            }
        }