jens-scheffler-bosch commented on PR #33355:
URL: https://github.com/apache/airflow/pull/33355#issuecomment-1679517355

   > Interesting approach. Glad that you hought about lock and hash 
@jens-scheffler-bosch . I could think about the case where the venv will be 
partially created if it fails during cration.
   > 
   
   Thanks for the review @potiuk ! Try/Except added - leftover technical "risk" 
is that cleanup also fails (for whatever e.g. IO reason) then a leftover 
cleanup might need manual involvement. I thought (a moment) about how a 
completion in setup can be made safe, best would be to install venv in a 
separate folder and move to final folder when completed. But moving a venv 
seems not to be working, a small test showed that packages are broken if folder 
is moved. If you have any better idea to detect a partly installed venv let me 
know.
   
   > There is also one other case that is difficul to handle. What happens if A 
virtualenv operator install another dependency after the venv is created. I am 
not sure if we can do anything about it, but maybe we could store a kind of 
checksum that would invalidate the venv in case it has been updated after 
creating it?
   
   Each cached virtualenv is created by the list of requirements. If different 
tasks are using the same requirements, the hash will be stable and venv can be 
re-used. Different requirements will make a different hash.
   Caching needs to be of course taken with case. Any "pollution" of temp 
files, added or deleted packages during use will influence other task 
executions. Other than restricting file permissions (which is usually 
impossible if not executed as root) I see no "easy" way to ensure integrity 
(Except making a hash along the folder tree which would be an expensive 
operation).
   If you really fear such problem will appear I propose I could add a note to 
the docs.


-- 
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]

Reply via email to