karlicoss / HPI

Human Programming Interface 🧑👽🤖
https://beepb00p.xyz/hpi.html
MIT License
1.47k stars 61 forks source link

core: --parallel flag can be flaky at times #306

Open karlicoss opened 1 year ago

karlicoss commented 1 year ago

E.g. see here https://github.com/karlicoss/HPI/pull/304 and we had some other issues with it before I guess it could use some stress testing to figure out what actually results in race conditions, or perhaps make it a bit more defensive (add some retries) -- at least during CI this should be acceptable

karlicoss commented 1 year ago

happens a lot lately, definitely worth trying with retries

karlicoss commented 1 year ago

Been flaky really often, so took another look at this -- essentially it's flaky because pip not really meant to be running in parallel, e.g. it can observe intermediate metadata state from other package and crash.

I thought we could benefit a lot at least from downloading in parallel https://github.com/pypa/pip/issues/825. There is a --use-feature=fast-deps which I think should provide parallel downloads -- but it didn't seem to do any impact, not sure why.

I took a look what's taking so much time using mypy-misc pipeline in tox as an example -- it's installing many modules, but without parallel mode to track time taken at each step. The bulk of it is:

The above sums up to about 2.5 minutes, which is like 80% of time the whole tox pipeline is running, so worth digging how to optimize this. In the meantime going to disable parallel install on ci, since it fails so much it defeats the purpose basically (to merge things faster)

karlicoss commented 1 year ago

For h3, seems that it doesn't have 3.12 wheels, so it's building them from scratch, and as a result pip3 install --user --force-reinstall --no-cache h3 -vvv can take like 60 seconds on osx https://pypi.org/project/h3/#files possibly relevant https://github.com/uber/h3-py/issues/326 pip debug --verbose is useful to find out compatible wheel tags

karlicoss commented 1 year ago

For git repositories it's basically the same issue -- there are no wheels so it takes a while to build them. Kinda odd that there is no builtin support for parallelization during wheel building. There are two options as I see it:

karlicoss commented 1 month ago

I think with uv perhaps this won't be an issue anymore