public void RenderDefaultMultiQueueGraphTest() { var rand = new Random(DEF_RAND_INIT); var tasks = TestTaskFactory.CreateMeshedCascade(rand, DEF_TASK_COUNT, DEF_TASK_LEVELS, DEF_TASK_MIN_DEPS, DEF_TASK_MAX_DEPS, "A", "B", "C"); TaskGraphRenderer.DisplayGraph(tasks); }
private TaskGraphMonitor InitializeWithTasks(TaskManager tm, int randInit = DEF_RAND_INIT, int count = DEF_TASK_COUNT, int levels = DEF_TASK_LEVELS, int minDeps = DEF_TASK_MIN_DEPS, int maxDeps = DEF_TASK_MAX_DEPS) { var rand = new Random(randInit); var queueTags = (from wl in tm.WorkingLines select wl.QueueTag).ToArray(); var tasks = TestTaskFactory.CreateMeshedCascade(rand, count: count, levels: levels, minDeps: minDeps, maxDeps: maxDeps, queueTags: queueTags); var tgMon = new TaskGraphMonitor(tasks); tm.AddTasks(tasks); return(tgMon); }
private TaskGraphMonitor CancellationBeforeStart(TaskManager tm, EventMonitor <TaskManager> tmMon) { var tgMon = InitializeWithTasks(tm); // find a task with responsibilities and dependencies var cancelTask = TestTaskFactory.TasksWithResponsibilities(tgMon.Tasks).FirstOrDefault(); Assert.IsNotNull(cancelTask); // cancel the task manager as soon as this task gets worked on cancelTask.StateChanged += (sender, ea) => { if (ea.NewValue == TaskState.InProgress) { Debug.WriteLine("CANCEL"); tm.Cancel(); } }; return(tgMon); }