-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
Qt Creator 11.0.0-beta1 (master branch)
-
None
-
-
29f634a8c (master)
Add a possibility to:
1. Define "Timeout(int msecs)" item that could be inserted into a Group. Since now only Done and Error results of Task execution are possible, we should add a new Timeout type as next possible result.
2. Add new result type Canceled, issued when TaskTree::stop() was invoked, or when some task got aborted because of a failure of other task and stopped by a parent Group because of its workflow policy. May be diverged into two possibilities: CanceledByUser (TaskTree::stop() was executed) and CanceledByTaskTree (automatically canceled by TaskTree according to workflow policy). TODO: should be confronted with Group's workflow policy - maybe the latter needs to have more values?
3. Define "Repeat(int count)" item that could be inserted into a Group. This would repeat the execution of the whole group "count" times in a row (sequentially).
4. Define "Delay(int msecs)" item that could be inserted into a Group. Similar to Timeout(int msecs), but this element could define its custom done handler ![]()
5. Make it possible to start next (or nested) task only after the previous (parent) already started (or later, when it already replied it's ready). For this we would need to add TaskInterface::started() signal (or other, like: readyToStartSubTasks()). Nesting tasks in this case is better, since stopping it would preserve the right order automatically. TaskInterface::started() signal seems enough - other cases (when ready after task replied) are very specific to the particular task and providing a new adapter with delayed emission of started() signal would be enough (similar to how it's done in case of master ssh process). Whenever a parent task finishes, all children should be stopped automatically
. When the last child finishes, should parent be automatically finished
.
6. Add fine-grained progress reporting for all task types. Maybe task setup handler could accept additional argument, similar to QPromise with regards to progress reporting?
The 1. and 3. could serve for stress test implementation inside AutoTest plugin.
Side note: when having 1. and 3., a TrafficLight example (similar to state machine in Qt) could be implemented using TaskTree.
Some other maintenance remarks:
A) Unify done and error handlers (like QtcProcess unified finished() and errorOccurred() signals into one common done() signal):
- task's done and error handlers (leave just done handler with additional, not mandatory argument - may be a struct)
- OnGroupDone and OnGroupError handers (leave just OnGroupDone with additional, not mandatory argument - same as in case of task's done handler)
- TaskTree::done() and TaskTree::errorOccurred() signals (leave just done() signal with additional argument - same as in case of OnGroupDone handler).
Rationale:
- It's often case that user code connects to both TaskTree::done() and TaskTree::errorOccurred() signals and the implementation is nearly the same.
- It's more clear that the task tree is already finished when there is only one done() signal. When having errorOccurred() in addition it's not clear that done() handler won't be called afterwards.
B) Rename TaskItem into GroupItem. (Rename internal TaskNode and TaskContainer accordingly).
Rationale: Not all classes derived from TaskItem are tasks, but the common denominator is that all may be placed inside a group: thus GroupItem sounds more appropriate.
C) Rename CustomTask into Task
Rationale: Every final task is derived from CustomTask, so the Task name is general enough and more appropriate here. Note: don't confuse with ProjectExplorer::Task (and don't clash when both ProjectExplorer and Utils::Tasking namespaces are used together):
- The ProjectExplorer::Task may be a subject to rename, as it's rather a simple data container, not a task per se. The name "Task" in too general in this context and shouldn't be reserved for this specific usage.
- Could be renamed to e.g. TaskHubData
- Currently ~880 usages of "Task", however, most refers to it's enum values, like Task::Error (325 usages), Task::Warning (180 usages), Task::Unknown (60 usages) or Task::TaskType itself (140 usages) - in total about 700 usages of "Task" name are because of this enum. This enum could be potentially moved outside.
- The ProjectExplorer::Task may be confused with Utils::TaskTree framework and one may think that both classes may work together - that's wrong impression.
D) Make most of current GroupItem's subclasses final?
E) Add some tests for triggering the appropriate runtime assert (e.g. putting 2 instances of OnGroupSetup handler into one Group, placing 2 instances of the same copy of Storage into the tree, etc...).
F) Pimpl GroupItem, make it implicitly shared - for Qt adaptation puproses. Measure somehow the impact, though it should be probably neglected.
G) Refactor GroupItem c'tors
H) When stopping a tasks inside a Group, stop them in reverse order ![]()
| For Gerrit Dashboard: QTCREATORBUG-28741 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 598809,6 | TaskTree: Add a test for delayed deletion of task after nested loop | 15.0 | qt-creator/qt-creator | Status: NEW | 0 | 0 |
| 461472,25 | TaskTree: Introduce WaitFor, Condition and ConditionActivator | master | qt-creator/qt-creator | Status: MERGED | -1 | 0 |
| 480233,24 | TaskTree: Introduce Timeout task | 11.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 480453,22 | TaskTree: Rename TaskItem into GroupItem | 11.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 482066,7 | TaskTree: Rename setupRoot into setRecipe | 11.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 485793,7 | TaskTree: Rename TaskAction into SetupResult | 11.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 497309,5 | TaskTree: Get rid of registration macros | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 515154,16 | TaskTree: Introduce DoneWith enum | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 515937,13 | TaskTree tests: Detect canceled state | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516143,18 | TaskTree: Introduce List element | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516149,14 | TaskTree: Rename workflow policies | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516150,13 | TaskTree: Rename StopWithDone -> StopWithSuccess | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516157,18 | TaskTree: Implement storage shadowing | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516242,17 | TaskTree tests: Add tests triggering runtime asserts | master | qt-creator/qt-creator | Status: MERGED | -1 | 0 |
| 516245,17 | TaskTree: Make storages thread-safe | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516281,16 | TaskTree tests: Add stress test for storages | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 516566,29 | TaskTree: Split completely const and runtime trees | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 519626,8 | TaskTree: Get rid of Storage subclass of GroupItem | master | qt-creator/qt-creator | Status: MERGED | -1 | 0 |
| 519627,7 | TaskTree: Hide more internals inside StorageBase class | master | qt-creator/qt-creator | Status: MERGED | -1 | 0 |
| 519628,8 | TaskTree: Rename TreeStorage<> -> Storage<> | master | qt-creator/qt-creator | Status: MERGED | -1 | 0 |
| 519629,27 | TaskTree: Update docs for Storage renamings | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 525936,4 | TaskTree: Remove explicit List element | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 530468,10 | TaskTree: Introduce TaskTreeRunner | master | qt-creator/qt-creator | Status: MERGED | -1 | 0 |
| 541070,8 | TaskTree: Introduce ExecutableItem | 13.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 541072,11 | TaskTree: Add withLog() function | 13.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 541075,18 | TaskTree: Add tests for withLog() function | 13.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 541454,7 | TaskTree: Implement asyncCount() | 13.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 541851,5 | TaskTree: Add info about sync/async execution into withLog() | 13.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 569316,12 | TaskTree: Make it possible to pass DoneResult as a done handler | 14.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 597415,6 | TaskTree: Add withAccept() decorator | 15.0 | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 601274,6 | TaskTree: Warn about recursive execution of handlers | 15.0 | qt-creator/qt-creator | Status: MERGED | +2 | +1 |
| 626489,9 | TaskTree: Introduce BarrierItem | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 663183,9 | TaskTree: Rename CallDoneIf and its values | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |
| 663189,15 | TaskTree: Introduce CallDoneFlags | master | qt-creator/qt-creator | Status: MERGED | +2 | 0 |