Commit Graph

29 Commits

Author SHA1 Message Date
Jarek Kobus
003b43aee7 TaskTree: Rename setupRoot into setRecipe
The passed Group root element is a recipe with
a full description on how to execute the tasks
and how to handle finished tasks.

We have already virtual methods / setters called like:
deployRecipe, refreshRecipe, reloadRecipe. So, the
common "recipe" is kind of consistent.

Fix typos in warnings.

Addresses the 11th point in the task below.

Task-number: QTCREATORBUG-28741
Change-Id: I1c80f4838b6a3e5ed113eaf8e42b59746d098efe
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-08 11:31:57 +00:00
Jarek Kobus
d97d3f58ac TaskTree: Rename TaskItem into GroupItem
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.

Addresses the 10th point in the bugreport below.

Task-number: QTCREATORBUG-28741
Change-Id: I94d728a8e39ec732810f2e5bbe6b9a76f3bc387c
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-06-06 09:06:01 +00:00
Jarek Kobus
3ee32c1a3b TaskTree: Reuse withTimeout()
Add static runBlocking() overloads.
Replace int timeout arg with std::chrono::milliseconds.

Change-Id: Id10a010f05eda8452cd7e4cd9ee46216087fc70e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-01 10:54:10 +00:00
Jarek Kobus
b2dadeb30c TaskTree: Fix the empty Group's return result
Get back to the originally intended behavior
for StopOnDone and ContinueOnDone workflow policies.
By default, these policies report an error until
at least one child task finished with success.
Since the group is empty, no child finished with success,
so the group should report an error.

Change also the return result for the StopOnFinished policy
when placed in an empty group. The policy is meant to
report the finished child's result. Since no task finished,
report an error in this case.

Fix tests accordingly.

Amends c9638ff642

Change-Id: Idc449e8c68a658755bf566df56844126167f1751
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-01 10:53:28 +00:00
Jarek Kobus
619735d99d TaskTree: Introduce withTimeout()
Make it available for Group or CustomTask items.

Note, that when withTimeout() is used, the total
number of tasks grows by one.

Change-Id: Idc71737ba66b92bdc4bf17599c793b1127d22f5e
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-01 10:53:21 +00:00
Jarek Kobus
1599106a22 TaskTree: Make the TimeoutTask reliable
Ensure the timeout tasks preserve the right order of
their done signals.

Change-Id: I62508d0710eb2324d7c347a9907a899c97d3975d
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-06-01 10:53:12 +00:00
Jarek Kobus
f6e7dbd416 TaskTree: Introduce Timeout task
By default, when finished, it returns success.
In order to convert it into failing task,
enclose it inside a Group with finishAllAndError.

Reuse it in tasking tests.

Task-number: QTCREATORBUG-28741
Change-Id: Ic81203203e0b139d4f9bfd553279ecb01cd303f4
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-01 10:53:04 +00:00
Jarek Kobus
5e9eadfc58 TaskTree: Introduce finishAllAndError workflow policy
It's going to be used in timeout task.

Change-Id: I2abd65b461cab445ada7a0ad5e1bbe07d1b6323b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-01 10:52:57 +00:00
Jarek Kobus
1a9025cdd5 TaskTree: Add docs for Workflow Policy
Transform it form TaskTree's description into WorkflowPolicy enum
docs. Document global workflow policy elements and global
workflowPolicy() function.

Change-Id: I4af3f7ffa703bbb1a9370e2fd1f9242a68131295
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-05-31 09:59:23 +00:00
Jarek Kobus
4e01ca18d1 TaskTree: Rename optional into finishAllAndDone
Rationale:
1. More descriptive.
2. More consistent with a planned new finishAllAndError policy.
3. Limits the possibilities of making a conflict with std::optional.

Change-Id: I5155630188e4b699e6c18b13a101e0e2d4fe98f2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-30 15:23:31 +00:00
Jarek Kobus
ffdb0c7dcc TaskTree: Some corrections to the copy example
Use QString instead of FilePath.
Rename the diffRecipe into copyRecipe.
Add some code that constructs the tree, connects to its done signal
and starts the tree.

Change-Id: I40e1c4784c736347682071b3e3e99db599ce102a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-30 15:23:20 +00:00
Jarek Kobus
cbca40401b TaskTree: Fix calling the proper group handler on stop
Add tests for it.

Change-Id: Ibb04b21c217196c9bbf6761851f4e1a300139a8c
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-30 15:23:08 +00:00
Jarek Kobus
78f2dda7ef TaskTree: Add docs for execution mode
Transform it form TaskTree's description into description
of sequential and parallel global variables, and into
docs for parallelLimit() global function.

Change-Id: I4aa2bac2f47778cde039cee77052359264224f93
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-05-30 09:37:38 +00:00
Jarek Kobus
05b922ca94 TaskTree: Add documentation for group handlers
Document onGroupSetup, onGroupDone and onGroupError methods,
TaskItem::Group{Start,End}Handler and TaskAction enum.

Change-Id: I7516b867a2e3ce33b8f15a18f85d1e61d673d65e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-30 08:24:53 +00:00
Jarek Kobus
a7ab1ba987 TaskTree: Doc corrections
Make docs more consistent.
Add some more precision when something is not clear.
Do some adaptations for behavioral changes.

Change-Id: I95c76fedf2c9d611702097842452186ea4cdf8b0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-05-26 09:34:27 +00:00
Leena Miettinen
9c6e3b724a Doc: Add \brief commands to namespace docs to show them in tables
...and at the top of the topics.

Change-Id: I3d521a351e06d765a79304db897c5cffa9fee0df
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-23 07:39:39 +00:00
Leena Miettinen
8c288bf05f Doc: Add "\inmodule QtCreator" to \class and \namespace docs
To get rid of QDoc warnings.

Change-Id: Idd39b7ae4327798c376f424c94d6617bcaee2258
Reviewed-by: hjk <hjk@qt.io>
2023-05-22 12:48:35 +00:00
Jarek Kobus
d8ed764611 TaskTree: Bring the documentation back
It vanished after recent move into Tasking lib.

Amends f84199f8b7

Change-Id: I561784c82285de41c2e29c257940678eeeccb5eb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-05-22 09:51:51 +00:00
Jarek Kobus
c9638ff642 TaskTree: Fix docs about empty Group and different workflows
Add tests for empty Group with different workflow policies.
Add tests for successful / failing task in a Group with
different workflow policies.

Change-Id: I50129713f836d2146b119ceb73b5ae43abf01639
Reviewed-by: hjk <hjk@qt.io>
2023-05-22 09:22:38 +00:00
Jarek Kobus
c098b261dc TaskTree: Refactor Group internal data
Introduce the GroupData structure. In this way it's easily
possible to add extra properties of already used types, e.g. int.

It's also possible to easily create elements with multiple
properties.

Simplify internal TaskItem::Type enum.

Get rid of special ParallelLimit and Workflow elements.
Provide global parallelLimit() and workflowPolicy() functions.

Make global items (e.g. parallel, stopOnDone, etc...) const.

Change-Id: Ic5628255b542fd6c5a5565b055ff11804c8d7b68
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 15:30:15 +00:00
Jarek Kobus
56fda87389 TaskTree: Get rid of OnGroup... elements
Change-Id: Id1b600999d2051eff8d2207db8235ad08eb6e663
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 15:30:04 +00:00
Jarek Kobus
04382d39a0 TaskTree: Introduce onGroup...() functions
The OnGroup... elements are going to be replaced with
these functions.

Change-Id: Ia271a89062cc9c6b18384607b20b1f68d273bcde
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 15:29:42 +00:00
Jarek Kobus
ceff14303a TaskTree: Prepare for OnGroup... -> onGroup... renaming
Change-Id: I52b695999b53b80fb8dbb77895080f6c1b86a58f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 15:29:35 +00:00
Jarek Kobus
7501d7587f TaskTree: Introduce WorkflowPolicy::StopOnFinished
The policy is useful mainly in parallel mode.
It stops executing the Group when any task finishes.
It reports the task's result.

Change-Id: I7aa98365cdc4c1eb869ab419d42d0cc5438d43bf
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 08:40:24 +00:00
Jarek Kobus
7bfc3197aa TaskTree: Add missing include
Amends 9c78ef983a

Change-Id: Id912771b2d23c6856233705a054c0e8e1e9b5a41
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 08:33:16 +00:00
Jarek Kobus
3763370ab9 TaskTree: Add Q_DISABLE_COPY_MOVE() into internal classes
Change-Id: I1b599902dfeebed93378a4d38bd3deb786f572b9
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 07:38:59 +00:00
Jarek Kobus
c603e01535 TaskTree: Don't derive TaskNode from QObject
It reduces the time spent inside TaskTree::setupRoot()
by ~30% for big trees (~7000 tasks).

Change-Id: Ic65ed0fdf511977d9cc2fe22bdac814516e9883d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-19 07:34:38 +00:00
Jarek Kobus
9c78ef983a TaskTree: Add runBlocking() helpers
To be used in non-main threads and in autotests.

Change-Id: If37be854f65c9cfe94eb781a28dc8db4365809e1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-19 07:16:48 +00:00
Jarek Kobus
f84199f8b7 Solutions: Long live Solutions!
Short live Tasking in Solutions!

Add src/libs/solutions/README.md with the motivation and hints.

Move TaskTree and Barrier from Utils into Tasking object lib,
the first solution in Solutions project.

Tasking: Some more work is still required for adapting auto and
manual tests. Currently they use Async task, which stayed in Utils.
For Qt purposed we most probably need to have a clone of
Async task inside the Tasking namespace that is more Qt-like
(no Utils::FutureSynchronizer, no priority field,
global QThreadPool instead of a custom one for Creator).

Change-Id: I5d10a2d68170ffa467d8c299be5995b9aa4f8f77
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-17 06:29:03 +00:00