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

uWSGI: Makes stubtest_allowlist_darwin more resilient against CI flakyness #11819

Merged
merged 14 commits into from May 15, 2024

Conversation

Daverball
Copy link
Contributor

@Daverball Daverball commented Apr 23, 2024

Don't merge this, just trying out some stuff in relation to #11813

Since this surfaced an old issue with the uWSGI stubs this should be considered for a merge after all as soon as the caching issue has been resolved.

@AlexWaygood
Copy link
Member

interesting. now stubtest is no longer crashing for uwsgi (but it is still complaining about not being able to load various modules at runtime), and it seems like this gets rid of the pyaudio error as well. The JACK-Client error looks unchanged, though.

@AlexWaygood
Copy link
Member

theoretically #11817 should have invalidated the cache key though (since it edited a METADATA.toml file in the stubs/ directory, so maybe if we did another rerun on the main branch we'd see the same thing

@Daverball
Copy link
Contributor Author

The uwsgi failures specifically are version specific attributes that are turned on/off depending on what's available on the system, I've had some flakyness with that in the past where the missing attributes weren't consistent between CI runs, I think I've had those very same attributes on the ignorelist for macOS in the past and then they had to be taken off again. Could potentially be mitigated using a RegEx, since IIRC stubtest won't complain if a regex entry doesn't match any failures.

@AlexWaygood
Copy link
Member

IIRC stubtest won't complain if a regex entry doesn't match any failures.

You need to use a clever regex that will also match on a zero-length sequence, e.g.

(thing_that_might_exist_or_not)?

@AlexWaygood
Copy link
Member

AlexWaygood commented Apr 23, 2024

theoretically #11817 should have invalidated the cache key though (since it edited a METADATA.toml file in the stubs/ directory, so maybe if we did another rerun on the main branch we'd see the same thing

I confirmed this by running the daily test manually from my fork (did it from my fork so that the bot wouldn't open a new issue on the run failing again): https://github.com/AlexWaygood/typeshed/actions/runs/8800720075/job/24152501055. Uwsgi now just fails on main rather than crashing on main, and the pyaudio errors are gone. So we shouldn't need to remove the pip cache now that the cache key has been invalidated.

EDIT: but it's still crashing for uwsgi on this PR. Ugh I have no idea.

@Daverball Daverball changed the title DEBUG: Temporarily disables pip cache for daily stubtest third party run uWSGI: Makes stubtest_allowlist_darwin more resilient against CI flakyness Apr 23, 2024
@Daverball
Copy link
Contributor Author

@AlexWaygood I think that's because the cache for the regular third party stubtest workflow is separate from the one for the daily run.

@AlexWaygood
Copy link
Member

AlexWaygood commented Apr 23, 2024

@AlexWaygood I think that's because the cache for the regular third party stubtest workflow is separate from the one for the daily run.

sure but it has the same cache key, right? If the cache key has been invalidated by the recent change to the METADATA.toml file for the daily test, it should also have been invalidated for the regular workflow

- uses: actions/setup-python@v5
with:
# TODO: Use Python 3.12. As of 2024-03-08, several third-party
# packages fail to install with Python 3.12.
python-version: "3.11"
cache: pip
cache-dependency-path: |
requirements-tests.txt
stubs/**/METADATA.toml

@Daverball
Copy link
Contributor Author

Daverball commented Apr 23, 2024

I don't really know enough about how setup-python generates the cache key to answer that question. My assumption would've been that each workflow definition has its own cache given that there's multiple entries for MacOS-Python3.11 on the main branch. Otherwise there would only be one, right? Actually nevermind, it makes sense that there are two entries for 3.11, if the cache-depdendency-path is the only thing informing the cache key other than the platform and python version. For some reason I thought there were more than two on the main branch, but I probably was off by a row when reading the table.

Also I think each fork has its own cache, so I'm not sure it can be tested the way you did it.

@AlexWaygood
Copy link
Member

Also I think each fork has its own cache, so I'm not sure it can be tested the way you did it.

Ugh I guess that makes sense

@Daverball
Copy link
Contributor Author

Looks like having any cache at all breaks things, although it's unclear to me whether my change actually did cause a fresh cache to be created for MacOS specifically, I only see a new cache entry for Windows and Ubuntu and I see the MacOS cache from the main branch was also used recently, despite no recent workflow runs...

So it appears like the cache reuse/invalidation logic is not as simple as it seems. It's possible it's eagerly using the most recent cache that could be used as a base and instead relying on pip causing a reinstall simply based on the version number of the package and only uploading a new version of the cache if any files changed. So cache invalidation would never happen for unrelated packages, only for the package that had its pinned version changed.

srittau
srittau previously approved these changes Apr 24, 2024
@srittau srittau dismissed their stale review April 24, 2024 08:59

stubtest fails, things are weird

@Daverball
Copy link
Contributor Author

Daverball commented Apr 24, 2024

Now Ubuntu started failing for pyaudio as well...

Although that may be because Microsoft borked their aptitude mirror for jammy, also getting errors on an unrelated project.

@Daverball
Copy link
Contributor Author

@AlexWaygood I'm fairly confident now that the whole cache key thing almost doesn't affect if/which cache it pulls in to restore at the beginning, it seems to either always pull in something regardless of cache key as long as there's a matching cache for the given python version and platform or it completely ignores the state of a branch and calculates the cache key based on the main branch.

It looks to me like the cache key is only used to write out a new version of the cache when it changes, but never to completely invalidate an old cache.

Can we get someone to test deleting all the "setup-python-macOS-python-3.11.9" caches, so we can start from a blank slate?

@Daverball
Copy link
Contributor Author

Looks like this has resolved itself

@JelleZijlstra
Copy link
Member

Do you still think we need this change?

@Daverball
Copy link
Contributor Author

Daverball commented May 15, 2024

@JelleZijlstra If we can re-enable these tests on MacOS, then we should, yes.

@JelleZijlstra
Copy link
Member

Seems like it passes now, so let's merge.

@JelleZijlstra JelleZijlstra merged commit d3faa5a into python:main May 15, 2024
38 checks passed
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

Successfully merging this pull request may close these issues.

None yet

4 participants