/// <summary> /// This function runs in its own thread, dequeueing actions from the actions queue and sending them to the /// appropriate scheduler. /// </summary> private void Execute() { while (!done) { ActionsQueueEntry entry; while (!done && actionsQueue.TryDequeue(out entry)) { SMVAction action = entry.Action; string schedulerType = action.executeOn; if (!schedulers.ContainsKey(schedulerType)) { Log.LogFatalError("Could not find scheduler of type: " + schedulerType + " while executing action " + action.name); } else { Log.LogDebug("scheduler found for " + schedulerType); ISMVActionScheduler scheduler = schedulers[schedulerType]; lock (Utility.lockObject) { Utility.result.Add(action.GetFullName(), "Skipped"); } scheduler.AddAction(action, new SMVActionCompleteCallBack(ActionComplete), entry); } } System.Threading.Thread.Sleep(2000); } }
/// <summary> /// Add a new scheduler to the list of schedulers used by the master scheduler. /// </summary> /// <param name="type">The type of scheduler you're adding. E.g., "local", "cloud"</param> /// <param name="scheduler">The scheduler to be added.</param> public void AddScheduler(string type, ISMVActionScheduler scheduler) { schedulers[type] = scheduler; }