TaskTree CS23: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Created page with "Category:QtCS2023 ==Session Summary== ==Session Owners== ==Notes==")
 
No edit summary
Line 6: Line 6:
==Session Owners==
==Session Owners==


Presentation by Jarek
Minutes taken by Volker


==Notes==
==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

Revision as of 12:21, 30 November 2023


Session Summary

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