truss icon indicating copy to clipboard operation
truss copied to clipboard

Transactional python requirements installation for live reload

Open pankajroark opened this issue 2 years ago • 0 comments

Currently, if multiple python packages are added via live-reload, there's a possibility that some python requirements get installed while others fail. In such a case, since the truss container cannot be allowed to be in an inconsistent state, a full redeploy/rebuild is triggered. This rebuild itself will fail due to the bad python requirement. Overall, this is not a great experience. It will be great to install the packages in a transactional manner, such that if any package installation fails, then the original python requirements can be restored.

There are a few ways to achieve this. One way would be keep the python requirements in a virtual environment, create a copy of the virtual environment for installation via live-reload, and only swap it for the used virtual environment if all installations succeed. This is a clean approach but requires creating a copy of the entire virtual environment, which could be slow and run into disk space issues. Perhaps an easier option would be to record the pip state and try to restore that state in case of failure.

pankajroark avatar Feb 20 '23 14:02 pankajroark