Proof of concept for 'dematerialized' environments#1162
Closed
chrisburr wants to merge 2 commits into
Closed
Conversation
Collaborator
|
This looks very promising! Would it be possible to automate this process completely from rattler? e.g. also building the underlay and setting up a complete environment (the things you are doing in the python example now)? |
Contributor
Author
|
I've put an alternative approach in #1182 While I could think of technical justifications for supporting both, my first instinct is that the FUSE method is the only one worth having. |
Contributor
Author
|
Replaced by #2566 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some context
I'm often working in HPC-like environments where networked file systems are used. The size and number of files involved in making a conda environment can put a lot of stress on the file systems and end up being slow for end users.
In high energy physics the solution we have to distributing software is a read-only distributed filesystem named CMVFS. I'm aware of it also being used by some other fields. Additionally, I'm aware of similar systems being used in other areas.
This idea started from the fact that it would be fairly easy to mount CVMFS "repository" which contains a cache directory of all conda-forge packages pre-extracted.
Proof of concept
The basic idea is to use Linux's overlayfs to build a conda environment by combining the rattler package cache directly as read-only underlays. This also avoids any limitations around hard linking across filesystems. Overlayfs is Linux only feature but I think the problems of limited filesystems are most apparent in Linux environments.
Building a conda environment like this does however have three limitations:
.pycfiles for noarch python packages(2) and (3) could be ignored and still have a fairly usable environment but (1) is absolutely essential to solve. This pull request adds an
is_overlayflag which only writes files to the target prefix if prefix replacement is being applied. This directory can then be applied as the highest priority underlay to override the files in the cache.(2) and (3) could be solved by adding a writable overlay (already included in the example activation script below).
You could even think about going one step further by making a FUSE based file system which generates the prefix-replaced files on the fly.
Example
I've done my testing with the following:
I'm using overlayfs-fuse here as it seems like the AFS filesystem that hosts my home directory deadlocks if I use
mount -t overlayfs. In other contexts I've been using--overlay-method=native.Install time
I didn't rigorously check the timing but these runs are representative from what I've seen. The "dematerialized" case can probably be further optimised (e.g. it currently makes more directories than it needs to).
Resource usage