zappa / Zappa

Serverless Python
https://zappa.ws/zappa
MIT License
3.31k stars 363 forks source link

Add a command to clear the wheel cache #1009

Closed GeoSpark closed 6 months ago

GeoSpark commented 3 years ago

This is a minor feature request, but one that had me scratching my head for ages!

I had added the cryptography package to my project and went to deploy. But at the moment the wheel was being downloaded and cached, my internet connection hiccuped (not sure if it was at my end, the company VPN, or something at Amazon's end). I killed the job and tried again, not realising what had actually happened. But afterwards Zappa would use the cached package but when I ran my Lambda it said it couldn't find the cryptography package.

After much head-scratching, I tracked down the cache directory and found the wheel was only 166KB instead of ~3MB. Once I deleted it and ran deployment again, it was happy.

So I know it's a minor thing that required a glitch at just the right time, and can easily solved by manually clearing the cache, but when it is hidden in the temp directory, it's not easy to find. So a switch or command to clear the wheel cache would be useful, or maybe it can do an MD5 checksum or similar.

dpmccabe commented 2 years ago

How did you find the wheel cache? I'm experiencing this problem now with the pandas package.

davidgolden commented 2 years ago

For @dpmccabe and those looking at this in the future, I ran into a similar issue. Zappa's logic for checking the cache is here https://github.com/zappa/Zappa/blob/a1e842cf95e5bd99a84e89d5eaaed42ff82f57eb/zappa/core.py#L951 Here https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir it states a couple variables to check. I checked the value of $TMPDIR in my venv, and deleted the contents of $TMPDIR/cached_wheels. That fixed things for me.

github-actions[bot] commented 7 months ago

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

github-actions[bot] commented 6 months ago

Hi there! Unfortunately, this Issue was automatically closed as it had not seen any activity in at least 100 days. If the Issue is still relevant to the latest version of Zappa, please open a new Issue.