Tasks C # 4.0 - subclass or display of execution tree?

Do you have any tips on how I can visualize the Task Tree? I will have a large set of long tasks, each of which has some child tasks, I want to visualize the execution for the user, ideally in the / DAG tree. If possible, I would like to use the new parallel task library

My first thought is to subclass Task and Name and describe feilds, and then try to find out if Task has properties to get a list of child tasks. Then I could use GraphSharp.codeplex.com or something similar (any preference?) To render the tree.

Any ideas / tips?

thank

David

+3
source share
1 answer

Personally, I would avoid subclassing Task (or Task<T>). This will cause TaskFactory to not behave correctly, but can also lead to a loss of flexibility or a very high required implementation for all functions.

I would instead create a class that schedules and runs a task for you. This class can be used to generate all your tasks (even just returning the task using the factory method). Inside, it can easily track your graphical information, use continuations in constructed tasks to track completion or failure events, etc.

+2
source

Source: https://habr.com/ru/post/1767913/


All Articles