/// <summary> /// Register a new graph process. Use methods on the returned object to map IO. /// </summary> /// <param name="processName">Unique user-friendly name within this graph.</param> /// <param name="processor">Function creating the processor.</param> /// <returns></returns> public RFGraphProcessDefinition <D> AddProcess <D>(string processName, string description, Func <RFGraphProcessor <D> > processor) where D : RFGraphProcessorDomain, new() { if (Processes.ContainsKey(processName)) { throw new Exception(String.Format("Already registered process {0}", processName)); } processor(); // test instantiation var newProcess = new RFGraphProcessDefinition <D> { Name = processName, Processor = processor, GraphName = GraphName, Description = description, IOMappings = new List <RFGraphIOMapping>() }; Processes.Add(processName, newProcess); return(newProcess); }
public RFGraphProcess(RFGraphProcessDefinition config) { Config = config; }
/// <summary> /// Configures graph process to automatically trigger on specific schedule /// </summary> /// <returns></returns> public RFGraphTaskDefinition AddScheduledTask <D>(string taskName, Func <List <RFSchedulerSchedule> > schedulesFunc, Func <RFSchedulerRange> rangeFunc, RFGraphProcessDefinition process, RFGraphInstance instance) where D : RFGraphProcessorDomain { var triggerName = RFEnum.FromString(taskName); var triggerKey = RFManualTriggerKey.CreateKey(EngineConfig.KeyDomain, triggerName, instance); // map to process' input process.MapInput <D>(d => d.Trigger, triggerKey); var task = new RFScheduledGraphTaskDefinition { RangeFunc = rangeFunc, SchedulesFunc = schedulesFunc, TaskName = taskName, GraphProcess = process, TriggerKey = triggerKey }; GraphTasks.Add(task); task.AddToEngine(EngineConfig); return(task); }
/// <summary> /// Configures graph process to automatically trigger on specific schedule /// </summary> /// <returns></returns> public RFGraphTaskDefinition AddScheduledTask <D>(string taskName, List <RFSchedulerSchedule> schedules, RFSchedulerRange range, RFGraphProcessDefinition process, RFGraphInstance instance) where D : RFGraphProcessorDomain { return(AddScheduledTask <D>(taskName, () => schedules, () => range, process, instance)); }