public static ProcessBatch CreateProcessBatch(List <string> rawfiles) { var processBatch = new ProcessBatch() { Id = Guid.NewGuid(), UserId = "me", Name = "My process batch", Path = @"C:\Prototype\diagramTest\TestData", Extension = ".test", ExtraInfo = new Collection <ExtraProcessInfo>() { new ExtraProcessInfo() { Key = "file", Value = "path" } } }; string rawFilePath = @"C:\SimSourceData"; var jobs = CreateProcessJobs(rawFilePath, rawfiles); ProcessGroup group = new ProcessGroup(); { }; List <ProcessGroup> seqs = new List <ProcessGroup>() { }; //seqs.Add(seq); // processBatch.Sequences = seqs; return(processBatch); }
public void ExecuteCompositeBatchParallelActivity(ProcessBatch batch, List <ComponentNode> workflowNodes, Guid sessionName) { WorkflowApplication workflowApplication = new WorkflowApplication( new CompositeBatchParallelActivity(), new Dictionary <string, object> { { "Batch", batch }, { "ComponentList", workflowNodes }, { "SessionName", sessionName } }); //workflowApplication.Extensions.Add(WinService.Log); workflowApplication.Extensions.Add(_callBack); _wfInstanceManager.ExecuteWorkflowInstance( workflowApplication, batch.Id); //WorkflowInvoker.Invoke(new CompositeBatchSequentialActivity(), // new Dictionary<string, object> // { // {"Batch", batch}, // {"ComponentList", workflowNodes}, // {"SessionName", sessionName} // }); }
private ProcessBatch CreateProcessBatch(Guid batchId, List <IdNamePair> measurements) { var processBatch = new ProcessBatch() { Id = batchId, UserId = "me", //jlin how about user id? Name = "Post upload batch", Path = "", Extension = ".batch", ExtraInfo = new Collection <ExtraProcessInfo>() { new ExtraProcessInfo() { Key = "file", Value = "path" } } }; string rawFilePath = ""; List <ProcessJob> jobs = CreateProcessJobs(measurements); ProcessGroup group = new ProcessGroup() { Name = "post upload group", Jobs = jobs }; processBatch.Groups.Add(group); return(processBatch); }
private static IEnumerable <ComponentNode> ExcuteComplexStartNode(List <ComponentNode> paramList, ComponentNode startNode, ICollection <ExtraProcessInfo> extraProcessInfos, INotificationCallback callback, ProcessBatch batch, ProcessGroup group, ProcessJob job) { Guid zero = new Guid(); IEnumerable <ComponentNode> childParams = from p in paramList where (p.ParentIdList.FirstOrDefault(pl => pl == startNode.Id) != zero) select p; IExecuteStartupComponent component = ProcessObjectLocator.LocateStartComponentProcess(startNode.CompopnentExcutionName); if (component != null) { //do waht ever client initiation here IResultForNextNode obj = component.ExecuteStartupComponent(batch, group, job, extraProcessInfos, paramList, startNode, callback); //since startup node takes raw file usually open it foreach (var param in paramList) { //set iRaw Data to each ComponentParameters param.StartupResult = obj; param.TreeExecutionTag = startNode.TreeExecutionTag; param.ParentComponentResults = new List <IResultForNextNode>(); param.ParentComponentResults.Add(obj); param.ProcessedParentCount = 0; } } return(childParams); }
private static ComponentNode ExcuteComplexComponentNode(List <ComponentNode> paramList, ComponentNode thisNode, INotificationCallback callback, ProcessBatch batch, ProcessGroup group, ProcessJob job) { ComponentNode nextNode = null; if (thisNode.CompNodeValidation == NodeValidationType.Group) { return(thisNode); } Debug.WriteLine(thisNode.ComponentName); thisNode.ProcessedParentCount++; if (thisNode.ProcessedParentCount != thisNode.ParentIdList.Count) { // _excutableInWait.Add(thisNode); return(null); } Guid zero = new Guid(); var childrenParams = (from p in paramList where (p.ParentIdList.FirstOrDefault(pl => pl == thisNode.Id) != zero) select p).ToList(); // IEnumerable<ComponentNode> childrenParams = from p in paramList where p.ParentId == thisNode.Id select p; //IExcuteComponent component = ProcessObjectLocator.LocateComponentProcess(thisNode.CompopnentExcutionName); Type tp = ProcessRunTimeLocator.GetExecutableType(thisNode.CompopnentExcutionName); if (tp == null) { return(null); } IExcuteComponent component = (IExcuteComponent)Activator.CreateInstance(tp); if (component != null) { IResultForNextNode ret = component.ExcuteThermoComponent(paramList, thisNode, callback, batch, group, job); if (ret != null) { ret.ThisNodeId = thisNode.Id; foreach (var param in childrenParams) { param.ParentComponentResults.Add(ret); } } } thisNode.ParentComponentResults.Clear(); //_excutableInWait.Remove(thisNode); thisNode.ProcessedParentCount = 0; foreach (var childrenParam in childrenParams) { nextNode = ExcuteComplexComponentNode(paramList, childrenParam, callback, batch, group, job); } return(nextNode); }
public ProcessBatch Create2SequenceProcessBatch(MnemeBatch batch) { string path = System.IO.Path.Combine(batch.Path, batch.Name + batch.Extension); var processBatch = new ProcessBatch() { Id = batch.Id, UserId = "me", Name = batch.Name, Path = batch.Path, Description = "test batch", Extension = batch.Extension, ExtraInfo = new Collection <ExtraProcessInfo>() { new ExtraProcessInfo() { Key = "file", Value = path } } }; List <string> processes = new List <string>(); for (int i = 0; i < 10; i++) { processes.Add("TestProcess1"); } string rawFilePath = @"C:\SimSourceData"; var jobs = CreateProcessJobs(rawFilePath, processes); ProcessGroup seq = new ProcessGroup() { Name = "sequence 1", EndOfSequenceProcess = "ClientEndOfSequenceProcess", Jobs = jobs, Description = "group test" }; List <ProcessGroup> seqs = new List <ProcessGroup>() { }; seqs.Add(seq); var jobs2 = CreateProcessJobs(rawFilePath, processes); ProcessGroup seq2 = new ProcessGroup() { Name = "sequence 2", EndOfSequenceProcess = "ClientEndOfSequenceProcess", Jobs = jobs2, }; seqs.Add(seq2); processBatch.Groups = seqs; processBatch.AppBatch = this; return(processBatch); }
public ProcessBatch GetProcessBatch() { var processBatch = new ProcessBatch() { Id = Guid.NewGuid(), UserId = "me", Name = "My process batch", Path = @"C:\Prototype\WorkflowTest\TestData", Extension = ".test", ExtraInfo = new Collection <ExtraProcessInfo>() { new ExtraProcessInfo() { Key = "file", Value = "path" } } }; string rawFilePath = @"C:\SimSourceData"; List <ProcessGroup> seqs = new List <ProcessGroup>() { }; int count = 0; foreach (var item in UiProcessBatch) { var jobs = CreateProcessJobs(item, rawFilePath); if (jobs.Count > 0) { ProcessGroup seq = new ProcessGroup() { Id = item.Id, Name = item.Name, Jobs = jobs }; count++; seqs.Add(seq); } } processBatch.Groups = seqs; return(processBatch); }
// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument string connection = context.GetValue(this.ConnectionString); long expId = context.GetValue(ExperimentId); long meauId = context.GetValue(MeasurementId); Guid batchId = context.GetValue(BatchId); ProcessBatch batch = new ProcessBatch(); if (expId != 0) { batch = CreateBatchFromExperiment(batchId, expId); } else { batch = CreateBatchFromMeasurementId(batchId, meauId); } Batch.Set(context, batch); // long priorityTicket = context.GetExtension<CriticalSectionQueueExtension>() //.GetPriorityTicket(queueName); // PriorityTicket.Set(context, priorityTicket); }
//complex solver internal static ComponentNode SolveComplexComponentTree(this ComponentSolver solver, List <ComponentNode> paramList, ComponentNode startNode, ICollection <ExtraProcessInfo> extraProcessInfos, INotificationCallback callback, ProcessBatch batch, ProcessGroup group, ProcessJob job) { ComponentNode nextComponent = null; IEnumerable <ComponentNode> children = ExcuteComplexStartNode(paramList, startNode, extraProcessInfos, callback, batch, group, job); foreach (var componentParam in children) { var comparam = ExcuteComplexComponentNode(paramList, componentParam, callback, batch, group, job); if (nextComponent == null) { nextComponent = comparam; } } return(nextComponent); }
public void TestPassingBatchAsParam(ProcessBatch batch) { Console.WriteLine(batch.Name); }