-
-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tox fails when run in parallel due to distdir #412
Comments
Is that not a problem with the CI you are using? Shouldn't that do the job of isolating the different runs from each other? Unless I understand the problem wrong this is working perfectly on all the CI systems I know (Bamboo, Travis, Appveyor, TeamCity). So could you clarify why this is going wrong? |
This has nothing to do with CI, is a generic issue which you could replicate by trying to run multiple tox commands in parallel. We need to find a way to avoid these errors, even if this would mean that tox could use a semaphore (file?) to avoid parallel execution problem in the few areas that are sensitive (command execution is assumed to be ok to run in parallel, or at least is up to the user to assure that). This was a long time ago but if I remember well both parallelization approaches are currently flawed
Please understand that I have like 5-10 testing commands that run in parallel inside the same codebase and virtualenv, there is no problem with this. The problem is what happens with tox before it starts to run the commands, that's the part that can fail due to parallelization. If we can find a way to address this we could speed-up building considerably. |
@obestwalter I observed that many people are reimplementing detox in bash and running something like (simplified):
This is similar to detox and works as well with one big exception: if you ever try to optimize the testing by sharing the same virtualenv across multiple targets. If you do this you lose the ability to run tox in parallel (either detox or bash) because tox will attempt to (re)create the same venv in parallel. If the venv is already created and it does not need any changes you may be lucky and run successfully. We really need to find a way to do both: because both approaches are essential for speeding up the build process. The irony is that they both (parallel and shared) reduce considerably the execution time like ~40-50% but we currently cannot use both of them. Doe this explain it? How can we find a workaround for this issue? Mainly I would say that tox needs to get a lock on the virtualenv when is changing it. If the lock is present, tox will wait for it to be released. This should probably fix both detox and bash parallelization. |
I've actually run into a similar issue but just when running any job. Not just those with Basically, what I was hoping to do, is setup the tox virtual environment with Here is an example
Going back to what someone said earlier, yes it is possible to run each of these in their own separate world. That said, it would be nice to run these on the same worker or whatever. The problem I ran into is that even though I pre-created the virtual environment, tox wants to delete and recreate a shared log directory here. This ends up running this One simple solution that I can see is instead of deleting the entire |
This will be fixed by #849 |
I tried to run tox in parallel from Jenkins, with different jobs for each environment but it seems that it fails at the
setup.py sdist
part because it uses the same temp directory.Initially I imagined that this was caused by pbr usage but now I suspect that's only a
tox
bug because it does not use a random--dist-dir
folder and multiple executions overlap, ending up breaking each other.Have a look at https://gist.github.com/ssbarnea/7829537a60592ba67567a67b946df1ea with a full log here
Before you would propose me to use
detox
instead please note that this CI this is not an option. I want to be able to use real pipelines in Jenkins so they would appear correctly and allow people to check the (eventually live) logs of each execution thread. If I would use tox it would not be able to do either of these.If we would be able to use expansions when conifguring
distdir
ortoxworkdir
we would be able to workaround this concurrency limitation but as far as I know expansions are not supported or they are not documented.The text was updated successfully, but these errors were encountered: