-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5c7a6a
commit 005555f
Showing
3 changed files
with
186 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
ARG BASE_IMAGE=git-515d637-jammy | ||
FROM ghcr.io/mamba-org/micromamba-devcontainer:$BASE_IMAGE | ||
|
||
# Ensure that all users have read-write access to all files created in the subsequent commands. | ||
ARG DOCKERFILE_UMASK=0000 | ||
|
||
# Install the fix-permissions script | ||
ADD --chmod=755 https://raw.githubusercontent.com/jupyter/docker-stacks/d8c60bc42cad227c5a35214a43a29c157c0a345e/images/docker-stacks-foundation/fix-permissions /usr/local/bin/fix-permissions | ||
|
||
# Create a fixed group for /opt/conda in case the user GID changes | ||
RUN sudo groupadd --gid 46328 mamba-admin && sudo usermod -aG mamba-admin "${MAMBA_USER}" | ||
|
||
# Install the Conda packages. | ||
ARG ENVIRONMENT_YAML=environment.yml | ||
COPY --chown=$MAMBA_USER:$MAMBA_USER ${ENVIRONMENT_YAML} /tmp/environment.yml | ||
RUN echo "use_lockfiles: false" >> ~/.mambarc && \ | ||
micromamba config append channels conda-forge && \ | ||
micromamba install --yes --name base --file /tmp/environment.yml && \ | ||
micromamba clean --all --force-pkgs-dirs --yes && \ | ||
sudo -E "NB_GID=mamba-admin" fix-permissions "${MAMBA_ROOT_PREFIX}" | ||
|
||
ARG MAMBA_DOCKERFILE_ACTIVATE=1 | ||
|
||
# Create and set the workspace folder | ||
ARG CONTAINER_WORKSPACE_FOLDER=/workspaces/default-workspace-folder | ||
RUN mkdir -p "${CONTAINER_WORKSPACE_FOLDER}" | ||
WORKDIR "${CONTAINER_WORKSPACE_FOLDER}" | ||
|
||
# On WSL the repo is mounted with permissions 1000:1000, but the mambauser inside the container has a different UID. | ||
# So we change the UID of the mambauser inside the container to match the UID of the user on the host. | ||
USER root | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
RUN groupmod --gid $USER_GID $MAMBA_USER \ | ||
&& usermod --uid $USER_UID --gid $USER_GID $MAMBA_USER \ | ||
&& chown -R $USER_UID:$USER_GID /home/$MAMBA_USER | ||
|
||
# Install SLURM and Munge | ||
RUN apt-get update && apt-get install -y \ | ||
slurm-wlm \ | ||
munge \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set up SLURM configuration | ||
COPY .devcontainer/slurm.conf /etc/slurm/slurm.conf | ||
RUN chmod 644 /etc/slurm/slurm.conf && \ | ||
mkdir -p /var/spool/slurmd && \ | ||
mkdir -p /var/run/slurm && \ | ||
mkdir -p /var/log/slurm && \ | ||
mkdir -p /var/lock/slurm && \ | ||
mkdir -p /var/spool/slurm && \ | ||
chown -R slurm:slurm /var/spool/slurmd /var/run/slurm /var/log/slurm /var/lock/slurm /var/spool/slurm | ||
|
||
# Create a startup script to ensure SLURM services are running | ||
RUN echo '#!/bin/bash' > /usr/local/bin/startup.sh && \ | ||
echo 'service munge start' >> /usr/local/bin/startup.sh && \ | ||
echo 'service slurmd start' >> /usr/local/bin/startup.sh && \ | ||
echo 'service slurmctld start' >> /usr/local/bin/startup.sh && \ | ||
echo 'exec "$@"' >> /usr/local/bin/startup.sh && \ | ||
chmod +x /usr/local/bin/startup.sh | ||
|
||
USER root | ||
|
||
CMD ["/bin/bash"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
{ | ||
"name": "micromamba", | ||
"runArgs": [ | ||
"--hostname", | ||
"devcontainer", | ||
"--name", | ||
"${localEnv:USER}_devcontainer_micromamba", | ||
"--privileged" // Add this to allow SLURM to manage processes | ||
], | ||
"containerEnv": { | ||
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}", | ||
"CONTAINER_WORKSPACE_FOLDER": "${containerWorkspaceFolder}" | ||
}, | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "..", | ||
"args": { | ||
"CONTAINER_WORKSPACE_FOLDER": "${containerWorkspaceFolder}", | ||
"BASE_IMAGE": "git-515d637-jammy", | ||
"ENVIRONMENT_YAML": "environment.yml" | ||
} | ||
}, | ||
"overrideCommand": true, // allow the entrypoint to run | ||
"mounts": [ | ||
"source=pre-commit-cache-${localEnv:USER},target=/home/mambauser/.cache/pre-commit,type=volume", | ||
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=cached", | ||
"source=${localWorkspaceFolder}/.devcontainer/slurm.conf,target=/etc/slurm-llnl/slurm.conf,type=bind" | ||
], | ||
"remoteUser": "mambauser", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.mypy-type-checker", | ||
"charliermarsh.ruff", | ||
"ms-toolsai.jupyter", | ||
"ms-azuretools.vscode-docker", | ||
"donjayamanne.githistory", | ||
"eamodio.gitlens", | ||
"mutantdino.resourcemonitor", | ||
"github.copilot", | ||
"davidanson.vscode-markdownlint" | ||
], | ||
"settings": { | ||
// Files to completely exclude from view | ||
// (see also search.exclude and files.watcherExclude) | ||
"files.exclude": { | ||
// Ignore cached files | ||
"**/__pycache__": true, | ||
// Ignore files created for development installs | ||
"**/*.egg-info": true, | ||
// Ignore Jupyter checkpoint files | ||
"**/.ipynb_checkpoints": true, | ||
// Ignore cache directory, except for files which start with . (e.g. .gitignore) | ||
".devcontainer/cache/*/[!\\.]*": true | ||
}, | ||
"[python]": { | ||
"editor.defaultFormatter": "charliermarsh.ruff" | ||
}, | ||
"ruff.path": [ | ||
"/opt/conda/bin/ruff" | ||
], | ||
"ruff.interpreter": [ | ||
"/opt/conda/bin/python" | ||
], | ||
// Ruler for "black"-formatted line widths | ||
"editor.rulers": [ | ||
88 | ||
], | ||
// Disable barely usable scrollbar | ||
"workbench.editor.wrapTabs": true, | ||
// Turn on autosave | ||
"files.autoSave": "afterDelay", | ||
// Show whitespace as tiny grey dots | ||
"editor.renderWhitespace": "boundary", | ||
// Use Pylance | ||
"python.languageServer": "Pylance", | ||
"python.analysis.typeCheckingMode": "basic", | ||
// Interpret lines beginning with "# !%" as ipython magic commands | ||
"jupyter.interactiveWindow.textEditor.magicCommandsAsComments": true, | ||
// Path of the default Python environment | ||
"python.defaultInterpreterPath": "/opt/conda/bin/python", | ||
// Disable the "conda activate base" command when opening a new terminal | ||
"python.terminal.activateEnvironment": false, | ||
// Automatically keep Git up-to-date with remotes | ||
"git.autofetch": "all", | ||
// Make sure that key combos like Ctrl+K are not intercepted by VS Code | ||
// when using the terminal | ||
"terminal.integrated.allowChords": false, | ||
"extensions.verifySignature": false | ||
} | ||
} | ||
}, | ||
"postCreateCommand": "sudo /usr/local/bin/startup.sh && sudo scontrol show config && sudo scontrol show nodes && sudo scontrol show partitions", | ||
"postStartCommand": "pip install -e ." | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
ClusterName=devcluster | ||
SlurmctldHost=localhost | ||
MpiDefault=none | ||
ProctrackType=proctrack/linuxproc | ||
ReturnToService=1 | ||
SlurmctldPidFile=/var/run/slurmctld.pid | ||
SlurmdPidFile=/var/run/slurmd.pid | ||
SlurmdSpoolDir=/var/spool/slurmd | ||
SlurmUser=slurm | ||
StateSaveLocation=/var/spool/slurm | ||
SwitchType=switch/none | ||
TaskPlugin=task/affinity | ||
InactiveLimit=0 | ||
KillWait=30 | ||
MinJobAge=300 | ||
SlurmctldTimeout=120 | ||
SlurmdTimeout=300 | ||
Waittime=0 | ||
SchedulerType=sched/backfill | ||
SelectType=select/cons_res | ||
SelectTypeParameters=CR_Core | ||
|
||
# COMPUTE NODES | ||
NodeName=localhost NodeAddr=127.0.0.1 CPUs=1 State=UNKNOWN | ||
PartitionName=debug Nodes=localhost Default=YES MaxTime=INFINITE State=UP |