Merge pull request #697 from manics/mamba

Switch to Mamba
This commit is contained in:
Yuvi Panda
2021-10-19 13:48:35 +05:30
committed by GitHub
5 changed files with 28 additions and 18 deletions

View File

@@ -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', '--mount', 'type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup',
'--detach', '--detach',
'--name', container_name, '--name', container_name,
# This is the minimum VM size we support. # A bit less than 1GB to ensure TLJH runs on 1GB VMs.
# If we change this, need to change all other references to this number. # If this is changed all docs references to the required memory must be changed too.
'--memory', '1G', '--memory', '900m',
] ]
if bootstrap_pip_spec: if bootstrap_pip_spec:

View File

@@ -76,8 +76,9 @@ Let's create the server on which we can run JupyterHub.
`Next: Configure Instance Details` in the lower right corner. `Next: Configure Instance Details` in the lower right corner.
Check out our guide on How To :ref:`howto/admin/resource-estimation` to help pick 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 how much Memory / CPU your server needs.
RAM. The smallest instance that can fit this is a **t3.small**. 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/>`_ 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. because it shows cost per hour. The **On Demand** price is the pertinent cost.

View File

@@ -13,14 +13,14 @@ def prefix():
""" """
Provide a temporary directory with a conda environment Provide a temporary directory with a conda environment
""" """
miniconda_version = '4.7.10' mambaforge_version = '4.10.3-7'
miniconda_installer_sha256 = "8a324adcc9eaf1c09e22a992bb6234d91a94146840ee6b11c114ecadafc68121" installer_sha256 = "fc872522ec427fcab10167a93e802efaf251024b58cc27b084b915a9a73c4474"
installer_url = "https://repo.continuum.io/miniconda/Miniconda3-{}-Linux-x86_64.sh".format(miniconda_version) 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 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.install_miniconda(installer_path, tmpdir)
conda.ensure_conda_packages(tmpdir, [ conda.ensure_conda_packages(tmpdir, [
'conda==4.8.1' 'conda==4.10.3'
]) ])
yield tmpdir yield tmpdir

View File

@@ -94,7 +94,7 @@ def ensure_conda_packages(prefix, packages):
""" """
Ensure packages (from conda-forge) are installed in the conda prefix. 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) abspath = os.path.abspath(prefix)
# Let subprocess errors propagate # Let subprocess errors propagate
# Explicitly do *not* capture stderr, since that's not always JSON! # Explicitly do *not* capture stderr, since that's not always JSON!

View File

@@ -172,24 +172,33 @@ def ensure_user_environment(user_requirements_txt_file):
miniconda_old_version = '4.5.4' miniconda_old_version = '4.5.4'
miniconda_new_version = '4.7.10' miniconda_new_version = '4.7.10'
miniconda_installer_sha256 = "8a324adcc9eaf1c09e22a992bb6234d91a94146840ee6b11c114ecadafc68121" # 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, miniconda_new_version): 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' conda_version = '4.8.1'
elif conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_old_version): elif conda.check_miniconda_version(USER_ENV_PREFIX, miniconda_old_version):
conda_version = '4.5.8' conda_version = '4.5.8'
# If no prior miniconda installation is found, we can install a newer version # If no prior miniconda installation is found, we can install a newer version
else: else:
logger.info('Downloading & setting up user environment...') logger.info('Downloading & setting up user environment...')
# FIXME: allow using miniforge installer_url = "https://github.com/conda-forge/miniforge/releases/download/{v}/Mambaforge-{v}-Linux-x86_64.sh".format(v=mambaforge_new_version)
installer_url = "https://repo.continuum.io/miniconda/Miniconda3-{}-Linux-x86_64.sh".format(miniconda_new_version) with conda.download_miniconda_installer(installer_url, installer_sha256) as installer_path:
with conda.download_miniconda_installer(installer_url, miniconda_installer_sha256) as installer_path:
conda.install_miniconda(installer_path, USER_ENV_PREFIX) 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.ensure_conda_packages(USER_ENV_PREFIX, [
# Conda's latest version is on conda much more so than on PyPI. # 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( conda.ensure_pip_requirements(