Run Test type tasks parallely GPars


(Manoj Shekhawat) #1

Hi, I’m trying to run multiple multiple Test type tasks parallely using GPars like:

task parallelTests {

    def tasksToRun = []
    tasksToRun << 'testsA'
    tasksToRun << 'testsB'

    GParsPool.withPool { ExecutorService exService ->
        tasksToRun.each { taskToRun ->
            exService.submit({ tasks[taskToRun].execute() } as Runnable)
        }
    }
}

But I’m getting below error:
Evaluating project ‘:api’ using build file ‘C:\Users\manoj7shekhawat\tests\api\api.gradle’.
Compiling build file ‘C:\Users\manoj7shekhawat\tests\api\api.gradle’ using SubsetScriptTransformer.
Compiling build file ‘C:\Users\manoj7shekhawat\tests\api\api.gradle’ using BuildScriptTransformer.
Evaluating project ‘:common’ using build file ‘C:\Users\manoj7shekhawat\tests\common\common.gradle’.
In-memory cache of C:\Users\manoj7shekhawat\tests.gradle\2.9\taskArtifacts\fileHashes.bin: Size{11319}, CacheStats{hitCount=11305, missCount=11319, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of C:\Users\manoj7shekhawat\tests.gradle\2.9\taskArtifacts\outputFileStates.bin: Size{5}, CacheStats{hitCount=1, missCount=5, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of C:\Users\manoj7shekhawat\tests.gradle\2.9\taskArtifacts\fileSnapshots.bin: Size{1}, CacheStats{hitCount=0, missCount=1, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of C:\Users\manoj7shekhawat\tests.gradle\2.9\taskArtifacts\taskArtifacts.bin: Size{2}, CacheStats{hitCount=0, missCount=2, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
Executing task ‘:api:testsApplications’ (up-to-date check took 8.239 secs) due to:
No history is available.
Starting process ‘Gradle Test Executor 1’. Working directory: C:\Users\manoj7shekhawat\tests\api Command: C:\Program Files\Java\jdk1.8.0_91\bin\java.exe -Dadmin.passwd -Dadmin.srv.loc=/usr/bin/admin -DadminEndPoint.env=/admin/v3 -Dadminpassword.env -Dadminuser.env -DappAdminpassword.env -DappAdminuser.env -DauditAdminpassword.env -DauditAdminuser.env -Dboot.config.loc=/tmp/test.conf -DbrowserType.env=firefox -Dclient.tokens=false -DclientId.env -DclientSecret.env -Dcompute.env=true -DdemoAppHostPort.env -Ddownload.dir=/tmp -Denv.mode=dev -DfirefoxLoc.env -DidAdminpassword.env -DidAdminuser.env -DidBridge_testDir.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/IDbridge_testData -Didaasintg.env=http://test.domain.com:1234 -DidcsBaseInternalUrl=http://test.domain.com:1234 -DidcsUIConsole.env=ui/v3/adminconsole -DidcsUIHost.env=http://test.domain.com:1234 -DidcsUIMyConsole.env=ui/v3/myconsole -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -DjobEndPoint.env=/job/v3 -DkeepBrowserOpen=false -Dmt=true -DoauthAppsHostPort.env -DoauthBaseUrl.env -DoauthMetricsEndpoint.env -DoauthMetricsHostPort.env -Dremote.host=test.domain.com -Dremote.password=NotMyPasswd -Dremote.username=manoj7shekhawat -DreportsEndPoint.env=/report/v3 -DsecurityAdminpassword.env -DsecurityAdminuser.env -DservicemngtURL.env -DsmEndPoint.env=/sm/v3 -DssoEndPoint.env=/sso/v3 -Dtenant.env=HACK7 -DtestConfiguration.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/testConfiguration -DtestData.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/testData -DtestDefaultData.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/testDefaultData -DtestGroup.env=A -DtestMode.env=all -DtestOperation.env=all -DtestType.env=mats -DtomacatLocation.env -DuserAdminpassword.env -DuserAdminuser.env -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -ea -cp C:\Users\manoj7shekhawat.gradle\caches\2.9\workerMain\gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain 'Gradle Test Executor 1’
Successfully started process 'Gradle Test Executor 1’
Executing task ‘:api:testsA’ (up-to-date check took 9.634 secs) due to:
Output file C:\Users\manoj7shekhawat\tests\api\build\reports\tests\index.html has changed.
Output file C:\Users\manoj7shekhawat\tests\api\build\test-results\binary\testsA\output.bin.idx has changed.
Output file C:\Users\manoj7shekhawat\tests\api\build\test-results\binary\testsA\results.bin has changed.
Gradle Test Executor 1 started executing tests.
Starting process ‘Gradle Test Executor 2’. Working directory: C:\Users\manoj7shekhawat\tests\api Command: C:\Program Files\Java\jdk1.8.0_91\bin\java.exe -Dadmin.passwd -Dadmin.srv.loc=/usr/bin/admin -DadminEndPoint.env=/admin/v3 -Dadminpassword.env -Dadminuser.env -DappAdminpassword.env -DappAdminuser.env -DauditAdminpassword.env -DauditAdminuser.env -Dboot.config.loc=/tmp/test.conf -DbrowserType.env=firefox -Dclient.tokens=false -DclientId.env -DclientSecret.env -Dcompute.env=true -DdemoAppHostPort.env -Ddownload.dir=/tmp -Denv.mode=dev -DfirefoxLoc.env -DidAdminpassword.env -DidAdminuser.env -DidBridge_testDir.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/IDbridge_testData -Didaasintg.env=http://test.domain.com:1234 -DidcsBaseInternalUrl=http://test.domain.com:1234 -DidcsUIConsole.env=ui/v3/adminconsole -DidcsUIHost.env=http://test.domain.com:1234 -DidcsUIMyConsole.env=ui/v3/myconsole -Djava.security.manager=jarjar.org.gradle.process.internal.child.BootstrapSecurityManager -DjobEndPoint.env=/job/v3 -DkeepBrowserOpen=false -Dmt=true -DoauthAppsHostPort.env -DoauthBaseUrl.env -DoauthMetricsEndpoint.env -DoauthMetricsHostPort.env -Dremote.host=test.domain.com -Dremote.password=NotMyPasswd -Dremote.username=manoj7shekhawat -DreportsEndPoint.env=/report/v3 -DsecurityAdminpassword.env -DsecurityAdminuser.env -DservicemngtURL.env -DsmEndPoint.env=/sm/v3 -DssoEndPoint.env=/sso/v3 -Dtenant.env=HACK7 -DtestConfiguration.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/testConfiguration -DtestData.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/testData -DtestDefaultData.env=C:\Users\manoj7shekhawat\tests\api\build/resources/test/testDefaultData -DtestGroup.env=B -DtestMode.env=all -DtestOperation.env=all -DtestType.env=mats -DtomacatLocation.env -DuserAdminpassword.env -DuserAdminuser.env -Dfile.encoding=windows-1252 -Duser.country=US -Duser.language=en -Duser.variant -ea -cp C:\Users\manoj7shekhawat.gradle\caches\2.9\workerMain\gradle-worker.jar jarjar.org.gradle.process.internal.launcher.GradleWorkerMain 'Gradle Test Executor 2’
Successfully started process 'Gradle Test Executor 2’
Gradle Test Executor 2 started executing tests.
Gradle Test Executor 1 finished executing tests.
Finished generating test XML results (0.003 secs) into: C:\Users\manoj7shekhawat\tests\api\build\QAtest-results\Apps
Generating HTML test report…
Finished generating test html results (0.009 secs) into: C:\Users\manoj7shekhawat\tests\api\build\reports\tests
Gradle Test Executor 2 finished executing tests.
Finished generating test XML results (0.002 secs) into: C:\Users\manoj7shekhawat\tests\api\build\QAtest-results\AppTemplates
Generating HTML test report…
Finished generating test html results (0.013 secs) into: C:\Users\manoj7shekhawat\tests\api\build\reports\tests

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':api'.
> Cannot call TaskInputs.source(Object) on task ':api:testsA' after task has started execution.

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 45.749 secs
Stopped 0 compiler daemon(s).
Cannot call TaskInputs.source(Object) on task ':api:testsA' after task has started execution.
12:37:23 PM: External tasks execution finished 'clean createUserFriendlyReport --continue -DdbHost=test.domain.com -DdbSid=xe -Dadmin.srv.loc=/usr/bin/admin  -Dboot.config.loc=/tmp/test.conf -Dremote.host=test.domain.com -Dremote.username=manoj7shekhawat -Dremote.password=NotMyPasswd -DtestType.env=mats -Dcompute.env=true -Ddown.dir=C:\\Users\\manoj7shekhawat\\ --info'.

Any resolutions?


(Dimitar Dimitrov) #2

This is code that is trying to run the project model configuration in parallel.

To achieve what I assume you want, set Test.maxParallelForks to more than 1.