Parallel Execution vs Tests

273 views
Skip to first unread message

Bruce Mitchener

unread,
Oct 27, 2011, 4:28:18 AM10/27/11
to simple-b...@googlegroups.com
Hello all,

I don't have an easy test case for this as we have an overly complicated build still...

I have a build where we have:

  • We are currently using sbt version 0.11.1-20111007-052041 (for the hash API changes).
  • all is a project that aggregates all-data and all-services.
  • all-data and all-services each aggregate more projects.
  • all-services have tests that can not run in parallel with each other.
  • We set parallelExecution in Test := false in the aggregating projects as well as the aggregated projects.
  • Yet the services aggregated by all-services are running their tests in parallel with each other.
If I do a show test:parallel-execution at the root level (or any other level), sbt tells me that it is false everywhere:

[info] service-a/test:parallel-execution
[info] false
[info] all-services/test:parallel-execution
[info] false
[info] data-a/test:parallel-execution
[info] false
[info] all-data/test:parallel-execution
[info] false
[info] all/test:parallel-execution
[info] false

The build definition looks similar to:

  lazy val all = BaseProject(
    id = "all",
    base = file("."),
    settings = parentSettings,
    aggregate = Seq(allServices, allData)
  )

  lazy val allServices = BaseProject(
    id = "all-services",
    base = file("."),
    settings = parentSettings,
    aggregate = Seq(
      serviceA
    )
  )

  lazy val allData = BaseProject(
    id = "all-data",
    base = file("."),
    settings = parentSettings,
    aggregate = Seq(dataA)
  )

  lazy val parentSettings = Defaults.defaultSettings ++ Seq(
    parallelExecution in Test := false,
    publishArtifact in Compile := false
  )

So:

  • Am I misunderstanding something?
  • Is this is an issue with using aggregates?
  • What other info can I provide to help?

As an aside, it would be nice if tests could still compile in parallel even if they don't run in parallel ... not sure if that's the case or not since I haven't gotten the tests to not run in parallel yet. :)

Thanks!

 - Bruce

Jason Zaugg

unread,
Oct 27, 2011, 4:35:29 AM10/27/11
to simple-b...@googlegroups.com

On Thursday, October 27, 2011 10:28:18 AM UTC+2, Bruce Mitchener wrote:
So:

  • Am I misunderstanding something?
  • Is this is an issue with using aggregates?
  • What other info can I provide to help?

As an aside, it would be nice if tests could still compile in parallel even if they don't run in parallel ... not sure if that's the case or not since I haven't gotten the tests to not run in parallel yet. :)


What problem are you having? I read your mail twice but I'm not sure what part is surprising you. All of your projects include `parallelExecution in Test := false`, via the shared sequence of settings `parentSettings.

Note that this setting only disables parallelism with the test suite of a single sub-project. If you need a stronger guarantee, you currently need to add `parallelExecution in Global := false`. (The FAQ actually suggests `parallelExecution := false`, I use `in Global` and haven't tested to see if the short version works.)

-jason

Bruce Mitchener

unread,
Oct 27, 2011, 4:41:29 AM10/27/11
to simple-b...@googlegroups.com
all-services actually has serviceA, serviceB, serviceC, etc.  Each of those have tests and need to execute in serial.  But I really don't want serial compilation of all of that (there's no reason for that at all).  But at the moment, despite the all-services saying to test in serial, the tests are happening in parallel with each other and that's breaking my stuff.

 - Bruce
 

Jorge Ortiz

unread,
Nov 10, 2011, 3:03:26 PM11/10/11
to simple-b...@googlegroups.com
Did anyone figure out a way to address this? I'm running into the same problem.

To clarify for Jason, there are two places where parallelExecution happens:

The first is among aggregated sub-projects. To use Bruce's terminology, if all-services aggregates serviceA, serviceB, and serviceC, then running all-services/test will run each of serviceA/test, serviceB/test, and serviceC/test in parallel.

The second is within a leaf project's tests. So, if just serviceA/test is running, does it run all its tests in parallel or in series.

Setting "parallelExecution in Test := false" disables the second kind of parallelism, but not the first. Setting "parallelExecution in Global := false" disables both kinds of parallelism, but does so for other things (like compile) that ideally WOULD be parallel.

Is there a way to disable both the first and the second kinds of parallelism for tests, while still maintaining parallelism for compiles and other tasks?

--j

--
You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.

Fernando Mora

unread,
Jun 25, 2014, 6:36:21 PM6/25/14
to simple-b...@googlegroups.com
Same problem here.

I have a project with four aggregated subprojects like this:

val main = play.Project(appName, appVersion)
  .aggregate(projectA, projectB, projectC, projectD)
  .settings(
    testOptions in Test += Tests.Argument("sequential", "true"),
    parallelExecution in Test := false,
    concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)
  )

I have tried with previous three options in main project settings, but, although tests of same subproject are executed sequentially, they are executed in parallel between different subprojects.

Setting option "parallelExecution in Global := false" solves my problem but it avoids parallel execution of other tasks like compilation, dist, stage, etc..

Some idea of how to configure project to avoid parallel execution only for test task along different aggregated projects but allow parallel execution for the rest of the tasks?
Reply all
Reply to author
Forward
0 new messages