示例#1
0
            public override void SendTask(TaskRunContext task)
            {
                //todo rewrite all this sht later
                if (taskCacheCollector == null)
                {
                    taskCacheCollector = base.GetTaskCacheCollector();
                }

                var data = ExtractInfoCountPerNode(task);
                var iter = data.GetEnumerator();

                int current = 0;

                var t           = 0;
                var coeff       = Math.Sin(t);
                var angleRandom = new Random();

                Utility.CreateAndRunRepeatedProcess(1000, false, () =>
                {
                    Common.Utility.ExceptionablePlaceWrapper(() =>
                    {
                        var info = GenerateTaskMockData(iter.Current.Item1.NodeName, t);
                        taskCacheCollector.push(task, task.TaskId, info);
                    }, " Exception while creating and pushing task mock data for taskId=" + task.TaskId + " in MockCacheCollectorFactory",
                                                             " Mock statistic data for task with taskId=" + task.TaskId + " have been generated and pushed", false);
                }, () =>
                {
                    if (current == 0)
                    {
                        if (!iter.MoveNext())
                        {
                            t = 0;
                            return(true);
                        }
                        current = iter.Current.Item2;
                    }

                    t += angleRandom.Next(5, 20);
                    --current;
                    return(false);
                });
            }
示例#2
0
 public static TaskCacheCollector GetInstance(/*IEnumerable<TaskRunContext> tasks*/)
 {
     return _instance ?? (_instance = new TaskCacheCollector(/*tasks*/));
 }
示例#3
0
 public static TaskCacheCollector GetInstance(/*IEnumerable<TaskRunContext> tasks*/)
 {
     return(_instance ?? (_instance = new TaskCacheCollector(/*tasks*/)));
 }
            public override void SendTask(TaskRunContext task)
            {
                //todo rewrite all this sht later
                if (taskCacheCollector == null)
                {
                    taskCacheCollector = base.GetTaskCacheCollector();
                }

                var data = ExtractInfoCountPerNode(task);
                var iter = data.GetEnumerator();

                int current = 0;

                var t = 0;
                var coeff = Math.Sin(t);
                var angleRandom = new Random();

                 Utility.CreateAndRunRepeatedProcess(1000, false, () =>
                 {
                     Common.Utility.ExceptionablePlaceWrapper(() =>
                     {
                         var info = GenerateTaskMockData(iter.Current.Item1.NodeName, t);
                         taskCacheCollector.push(task, task.TaskId, info);
                     }, " Exception while creating and pushing task mock data for taskId=" + task.TaskId + " in MockCacheCollectorFactory",
                        " Mock statistic data for task with taskId=" + task.TaskId + " have been generated and pushed", false);
                } , () =>
                {
                    if (current == 0)
                    {
                        if (!iter.MoveNext())
                        {
                            t = 0;
                            return true;
                        }
                        current = iter.Current.Item2;
                    }

                    t += angleRandom.Next(5,20);
                    --current;
                    return false;

                });
            }
示例#5
0
 public virtual TaskCacheCollector GetTaskCacheCollector()
 {
     return(pushTaskStat ? TaskCacheCollector.GetInstance() : new EmptyTaskCacheCollector());
 }