Skip to content
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

Unit Test performance #4

Open
cwaeland opened this issue Sep 9, 2020 · 3 comments
Open

Unit Test performance #4

cwaeland opened this issue Sep 9, 2020 · 3 comments

Comments

@cwaeland
Copy link

cwaeland commented Sep 9, 2020

Hi, first just wanted to thank you for providing this project as an example. It's been helpful in my work to setup my own Python toolchain.

One question I had was around unit test performance. Once I got my own version of Python 3 successfully configured I noticed that Bazel includes the toolchain version of Python 3 in the runfiles for each test target. This is not that surprising as it would help to make each target hermetic and aligns with the py_runtime documentation since providing files + an interpreter is considered an in build runtime.

However, on MacOS given the large number of files that need to be symlinked since the interpreter is now included I've noticed a huge slowdown when it comes to testing time. I've been briefly looking at using interpreter_path instead which would treat the runtime as a platform runtime and so not symlink the files. However, that requires an absolute path.

Have you experienced this on any of your projects? Is there something that can be done here?

Thanks!

@kku1993
Copy link
Owner

kku1993 commented Sep 10, 2020

Thanks! I'm glad this example has been helpful.

I haven't noticed this problem on my projects (maybe they need more tests :P). I wonder if you can trim some of the python build artifacts from [1] to reduce the number of symlinks.

[1]

srcs = glob(["bazel_install/**"], exclude = ["**/* *"]),

@cwaeland
Copy link
Author

Sure, I can take a look at that although I expect there's not too much that can be excluded.

One other possibility I was wondering about, which is probably less hermetic, is possibly leveraging the interpreter_path field since that would cause it not to symlink the python installation. Unfortunately it requires an absolute path. Do you know how we might generate one?

I'm also curious how you've found Bazel caching to be in CI with this approach.

@kku1993
Copy link
Owner

kku1993 commented Sep 11, 2020

I don't know of a way to generate an absolute path for the custom python interpreter :(

I haven't noticed anything wrt bazel caching in CI either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants