TaskTree CS23
Jump to navigation
Jump to search
Session Summary
- Introduction and Demo of the TaskTree from Qt Creator's library of solutions
Session Owners
- Presentation by Jarek
- Minutes taken by Volker
Notes
- Introduction to TaskTree
- generic Qt-based solution for automatic execution of a set of asynchronous tasks
- manages execution of tasks
- TaskTree class
- emits done signal with result
- executes "recipe" after the task tree has been started
- Recipe
- a value of type "Group"
- doesn't do anything on its own
- encapsulates
- execution mode (e.g. "sequential", "parallel")
- workflow policy ("stopOnError")
- list of tasks
- Group objects can be nested
- Tasks can be of type ConcurrentCallTask<ResultType>, using Qt Concurrency types
- Custom tasks, subclassing TaskAdapter<Type>
- describes how to create an asynchronous task
- E.g. QTimer, QProcess, ConcurrentCall, NetworkQuery, ...
- Naming convention: tasks correspond to task class type, e.g. QProcessTask is a TaskAdapter<QProcess>
- Access task object with task(); reimplement start(), emit done
- Handlers
- custom tasks constructor takes 2 handler arguments (callables/functors): setup handler, done handler
- Storage<DataType> type provides inter-task data exchange
- handlers can capture the storage object
- storage uses a QSharedPointer for the data storage, so capturing by value is ok
- e.g. done-handler writes result to storage, setup-handler of next task reads data from storage
- Demo time
Discussion
- how to handle errors and clean up after error?
- Done handler
- any plans for a task graph?
- No plans
- Working on repeating tasks, which might be sufficient for task-reuse
- Is there a visual component?
- Not part of the scope, but there's an example/demo
- monadic APIs
- might be something worth looking into