Skip to content

Commit

Permalink
Merge pull request #697 from manics/mamba
Browse files Browse the repository at this point in the history
Switch to Mamba
  • Loading branch information
yuvipanda committed Oct 19, 2021
2 parents 4a7e545 + f61b7fb commit ebd76f7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/integration-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def run_systemd_image(image_name, container_name, bootstrap_pip_spec):
'--mount', 'type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup',
'--detach',
'--name', container_name,
# This is the minimum VM size we support.
# If we change this, need to change all other references to this number.
'--memory', '1G',
# A bit less than 1GB to ensure TLJH runs on 1GB VMs.
# If this is changed all docs references to the required memory must be changed too.
'--memory', '900m',
]

if bootstrap_pip_spec:
Expand Down
5 changes: 3 additions & 2 deletions docs/install/amazon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ Let's create the server on which we can run JupyterHub.
`Next: Configure Instance Details` in the lower right corner.

Check out our guide on How To :ref:`howto/admin/resource-estimation` to help pick
how much Memory / CPU your server needs. You need to have at least **1GB** of
RAM. The smallest instance that can fit this is a **t3.small**.
how much Memory / CPU your server needs.
We recommend you use a server with at least 2GB of RAM, such as a **t3.small**.
However, if you need to minimise costs you can use a server with **1GB** RAM such as a **t2.micro**, but performance will be limited.

You may wish to consult the listing `here <https://www.ec2instances.info/>`_
because it shows cost per hour. The **On Demand** price is the pertinent cost.
Expand Down
10 changes: 5 additions & 5 deletions tests/test_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ def prefix():
"""
Provide a temporary directory with a conda environment
"""
miniconda_version = '4.7.10'
miniconda_installer_sha256 = "8a324adcc9eaf1c09e22a992bb6234d91a94146840ee6b11c114ecadafc68121"
installer_url = "https://repo.continuum.io/miniconda/Miniconda3-{}-Linux-x86_64.sh".format(miniconda_version)
mambaforge_version = '4.10.3-7'
installer_sha256 = "fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-x86_64.sh".format(v=mambaforge_version)
with tempfile.TemporaryDirectory() as tmpdir:
with conda.download_miniconda_installer(installer_url, miniconda_installer_sha256) as installer_path:
with conda.download_miniconda_installer(installer_url, installer_sha256) as installer_path:
conda.install_miniconda(installer_path, tmpdir)
conda.ensure_conda_packages(tmpdir, [
'conda==4.8.1'
'conda==4.10.3'
])
yield tmpdir

Expand Down
2 changes: 1 addition & 1 deletion tljh/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def ensure_conda_packages(prefix, packages):
"""
Ensure packages (from conda-forge) are installed in the conda prefix.
"""
conda_executable = [os.path.join(prefix, 'bin', 'python'), '-m', 'conda']
conda_executable = [os.path.join(prefix, 'bin', 'mamba')]
abspath = os.path.abspath(prefix)
# Let subprocess errors propagate
# Explicitly do *not* capture stderr, since that's not always JSON!
Expand Down
25 changes: 17 additions & 8 deletions tljh/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,33 @@ def ensure_user_environment(user_requirements_txt_file):

miniconda_old_version = '4.5.4'
miniconda_new_version = '4.7.10'
miniconda_installer_sha256 = "8a324adcc9eaf1c09e22a992bb6234d91a94146840ee6b11c114ecadafc68121"

if conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_new_version):
# Install mambaforge using an installer from
# https://github.com/conda-forge/miniforge/releases
mambaforge_new_version = '4.10.3-7'
installer_sha256 = "fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
# Then run `mamba --version` to get the conda and mamba versions
# Keep these in sync with tests/test_conda.py::prefix
mambaforge_conda_new_version = '4.10.3'
mambaforge_mamba_version = '0.16.0'

if conda.check_miniconda_version(USER_ENV_PREFIX, mambaforge_conda_new_version):
conda_version = '4.10.3'
elif conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_new_version):
conda_version = '4.8.1'
elif conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_old_version):
conda_version = '4.5.8'
# If no prior miniconda installation is found, we can install a newer version
else:
logger.info('Downloading & setting up user environment...')
# FIXME: allow using miniforge
installer_url = "https://repo.continuum.io/miniconda/Miniconda3-{}-Linux-x86_64.sh".format(miniconda_new_version)
with conda.download_miniconda_installer(installer_url, miniconda_installer_sha256) as installer_path:
installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-x86_64.sh".format(v=mambaforge_new_version)
with conda.download_miniconda_installer(installer_url, installer_sha256) as installer_path:
conda.install_miniconda(installer_path, USER_ENV_PREFIX)
conda_version = '4.8.1'
conda_version = '4.10.3'

conda.ensure_conda_packages(USER_ENV_PREFIX, [
# Conda's latest version is on conda much more so than on PyPI.
'conda==' + conda_version
'conda==' + conda_version,
'mamba==' + mambaforge_mamba_version,
])

conda.ensure_pip_requirements(
Expand Down

0 comments on commit ebd76f7

Please sign in to comment.