potiuk commented on code in PR #33355:
URL: https://github.com/apache/airflow/pull/33355#discussion_r1295118289
##########
airflow/operators/python.py:
##########
@@ -606,7 +613,39 @@ def _prepare_venv(self, venv_path: Path) -> None:
index_urls=self.index_urls,
)
+ def _ensure_venv_cache_exists(self, venv_cache_path: Path) -> Path:
+ """Helper to ensure a valid venv is set up and will create inplace."""
+ hash_object =
hashlib_wrapper.md5(",".join(self._requirements_list()).encode())
+ requirements_hash = hash_object.hexdigest()
+ venv_path = venv_cache_path / f"venv-{requirements_hash[0:8]}"
Review Comment:
I think we miss a very important issue here. The cache path should also
depend on the exact Python version that is used (down to patchlevel). It's
obvious for minor versions but we had a problem where new patchlevel of Python
could not work with previously prepared venv cache with previous Python version
patchlevel.
This was a case once on our CI where we use caching for GitHub actions. The
previously prepared cache got broken when we updated to a new Python patchlevel
version.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]