Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up read-only container image store on NFS #13

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ RUN groupadd -g $GID $HOST_USER && adduser --gid $GID -u $UID --gecos "" \
--disabled-password $HOST_USER && \
adduser $HOST_USER sudo && groupadd -g 1338 docker && adduser $HOST_USER docker && \
ssed -i '/^%sudo/s/ALL$/NOPASSWD:ALL/' /etc/sudoers

# Update containerimages.conf in case of the file is modified manually.
# On slurm worker, they should be same. On controller, it might be different if user adds new images to the conf file before running setup.sh.
RUN rm /usr/local/share/slurm_gcp_docker/src/containerimages.conf
COPY containerimages.conf /usr/local/share/slurm_gcp_docker/src/
7 changes: 7 additions & 0 deletions src/containerimages.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

## List of images to be pulled to /mnt/nfs/clust_containers. Start line with "=".

=gcr.io/broad-getzlab-workflows/cga_production_pipeline:v0.1
=gcr.io/broad-getzlab-workflows/base_image
=chipstewart/pcawg_full:3

12 changes: 12 additions & 0 deletions src/prefect_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## This file will be read when prefect is imported

additionalimagestores = ["/mnt/nfs/clust_containers"]
backend = "server"

# output_dir_stem = "/mnt/nfs/workspace"
# use_podman = true
#
# [canine_backend_conf]
# type = "LocalDocker"

9 changes: 8 additions & 1 deletion src/provision_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def print_conf(D, path):
# Slurm conf. file cgroup.conf and boto conf can be copied-as is
# (other conf. files will need editing below)
subprocess.check_call(
"cp {CPR}/conf/cgroup.conf /mnt/nfs/clust_conf/slurm; cp {CPR}/conf/boto.conf /mnt/nfs/clust_conf/misc".format(
"cp {CPR}/conf/cgroup.conf /mnt/nfs/clust_conf/slurm; cp {CPR}/conf/boto.conf /mnt/nfs/clust_conf/misc; cp {CPR}/src/containerimages.conf /mnt/nfs/clust_conf/misc/containerimages.conf".format(
CPR = shlex.quote(CLUST_PROV_ROOT)
),
shell = True
Expand Down Expand Up @@ -144,6 +144,13 @@ def print_conf(D, path):

print_conf(C, "/mnt/nfs/clust_conf/slurm/slurmdbd.conf")

#
# Pull readonly container images. If those images already exist, it should be fast.
subprocess.check_call("""
cat /mnt/nfs/clust_conf/misc/containerimages.conf | grep '^=' | sed 's/^=//' | xargs -L1 sudo podman --root /mnt/nfs/clust_containers pull
""", shell=True, executable = '/bin/bash'
)

#
# start Slurm controller
print("Checking for running Slurm controller ... ")
Expand Down
4 changes: 4 additions & 0 deletions src/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ IVERSION=$(tr . - <<< $VERSION)

./generate_container_host_image.py -i slurm-gcp-docker-${IVERSION}-`git rev-parse --short HEAD`-$USER

# copy prefect config, this will be read by prefect when it is imported
mkdir -p ~/.prefect
cp prefect_config.toml ~/.prefect/config.toml

sudo docker build -t broadinstitute/slurm_gcp_docker:$VERSION \
-t broadinstitute/slurm_gcp_docker:latest \
--build-arg HOST_USER=$USER --build-arg UID=$UID --build-arg GID=$(id -g) .