Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Snakemake Debugging on Google Cloud
# This is a small script (that typically I copy paste) on a Google Cloud instance
# to set up an environment to mimic a worker. It includes installing snakemake,
# retrieving a package with the working directory (which typically has the
# version of snakemake I aim to develop or debug, and then interactively debugging
# or doing this.
sudo apt-get install -y wget bzip2 ca-certificates gnupg2 git
sudo chown -R $USER /opt
bash -b -p /opt/conda
export PATH=$PATH:/opt/conda/bin
conda install -y -c conda-forge mamba
mamba create -q -y -c conda-forge -c bioconda -n snakemake snakemake snakemake-minimal --only-deps
conda clean --all -y
source activate snakemake
mkdir -p /workdir
sudo chown -R $USER /workdir
cd /workdir
wget -O
chmod +x
# This command needs to be updated with your download archive, there should be an install of snakemake inside
python download snakemake-testing source/cache/workdir-09bda6e42f79362fe639d893de13495a84c2e2884961a9d828f9f865f33347f5.tar.gz /tmp/workdir.tar.gz
tar -xzvf /tmp/workdir.tar.gz
# Use -e to ensure we install from local directory
pip install -e .[reports,messaging,google-cloud]
pip install ipython
echo "source activate snakemake" > ~/.bashrc
export PATH=/opt/conda/envs/snakemake/bin:${PATH}
# Your custom command will go here, add ipython / other interaction
# into codebase before running!
snakemake snakemake-testing/dirtest/testdir --snakefile Snakefile --force -j --keep-target-files --keep-remote --latency-wait 5 --scheduler greedy --attempt 1 --force-use-threads --max-inventory-time 0 --allowed-rules directory --nocolor --notemp --no-hooks --nolock --default-remote-provider GS --default-remote-prefix snakemake-testing/dirtest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment