This message was deleted.
# performance
s
This message was deleted.
a
I thought that parallel tasks in a single subproject required configuration cache to be enabled
g
Either configuration cache enabled or the tasks need to use the worker API
šŸ‘ 1
t
parallel tasks existed way before CC, just
org.gradle.parallel
was enough
a
I think so as well. The
--parallel
flag enables inter-project parallelism.
t
but then how does it run compileKotlin and spotlessKotlin in parallel?
a
I would guess that’s because KotlinCompile uses the Worker API - but I’m not certain
āž• 2
t
wow, I think this confirms what you're saying:
Copy code
tasks.register("task1") {
	doFirst { Thread.sleep(1000) }
}
tasks.register("task2") {
	doFirst { Thread.sleep(1000) }
}
with or without
--parallel
a
it’s a bit funny sometimes actually, if a task uses the Worker API then it’s not possible for that same task to ā€˜wait’ until the worker tasks have completed and do some additional work
e
project isn't safe for use in parallel
worker API and configuration cache both prevent project access during execution so they can be parallel
otherwise gradle runs tasks serially within a single project
a
I think it would be worth making a feature request for Gradle Scan actually @twisterrob. Something like ā€œtasks that use the Worker API should be highlighted in the timelineā€, or ā€œthe timeline should show task execution time and worker execution times separatelyā€
t
so in the small test above, if I run
gradle task1 task2 --scan --parallel --configuration-cache
why is it not running in parallel?
@Adam would you mind doing that? I'm not sure I understand it enough to explain it.
a
I don’t use Gradle Scan so it doesn’t bother me :). I wanted to make that suggestion to validate that what you saw was indeed confusing, and probably confuses most people, and could be improved
t
You guys just blew my mind, I guess I had it good with 20+ module projects and didn't notice this šŸ™‚.
Is there anything I can do to make these tests run in parallel? Do I need to introduce multiple projects to run them? (which is not even possible, because the matrix test tasks are created dynamically based on a file/network call)
a
They should run in parallel, if you enable configuration cache. Can you share a build scan link where you run those (but without the
--parallel
flag, because it is superseded by CC) ?
t
ok, so that's weird then,
--parallel
disables CC's intra-project parallelism https://scans.gradle.com/s/5vok43zh42cys/timeline
(or maybe not, it's possible
--parallel
doesn't invalidate configuration cache reuse, testing...)
ok, so, caching is not the problem per se. In Gradle 7.6 the first execution (when CC is not reused yet)
gradle task1 task2 --scan --configuration-cache --parallel
does not run the tasks in parallel. Running the same command again immediately, will reuse CC, and will run the tasks in parallel. Gradle 8.2.1 works as expected, running tasks in parallel. I guess this might be related to the change in 8.x where the cache is always "reloaded" immediately after calculating it.
thank you, I'll try enabling CC for this project then šŸ¤ž
ooooh yeah, ripping my PC in pieces now!
šŸš€ 3
šŸ’„ 1
šŸ™‡