Skip to content

Instantly share code, notes, and snippets.

@gpfreitas
Last active February 7, 2023 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpfreitas/e6eaeb0c5559b0e6adad06438e440855 to your computer and use it in GitHub Desktop.
Save gpfreitas/e6eaeb0c5559b0e6adad06438e440855 to your computer and use it in GitHub Desktop.
Makefile to set up for dask tutorial given at realtor.com
# usage: place this file in a folder where you want to your dask tutorial work and run `make`
#
# if you want to a root dir other than ROOT_DIR, then copy this file there and run `make all`
ROOT_DIR = $(HOME)/reading_group_dask_tutorial
all: dask-tutorial conda_env
@echo ""
@echo "To run the dask tutorial now run"
@echo ""
@echo " cd dask-tutorial"
@echo " conda activate dask-tutorial"
@echo " export DASK_DISTRIBUTED__WORKER__MULTIPROCESSING_METHOD='fork'" # can be set permanently multiple ways
@echo " jupyter lab --allow-root # or whatever command you use for a remote jupyter lab if in a remote machine"
@echo ""
@echo "When you are done with dask-tutorial, you can remove all the files and the conda env with"
@echo ""
@echo " make clean"
@echo ""
dask-tutorial:
@echo "BEGIN: cloning dask-tutorial git repo"
git clone http://github.com/dask/dask-tutorial
@echo "DONE: cloning dask-tutorial git repo"
conda_env: env_explicit.txt
@echo "BEGIN: creating dask-tutorial conda environment"
conda create -y -n dask-tutorial
conda install -y --name dask-tutorial --file $<
@echo "DONE: creating dask-tutorial conda environment"
# these envs came from the dask-tutorial git repo, in binder/environment.yml
# after normal installation with conda env create -f binder/environment.yml
# we activated the env and created these files with conda list --explicit
env_explicit.txt:
@echo "BEGIN: downloading explicit conda environment file"
@if test $$(uname) = 'Darwin'; then \
echo "pull Darwin $@ file"; \
aws s3 cp s3://opcity-ds-scratch/guilherme/demos/dask_reading_group/setup/env_osx12.6_20230203.txt ./$@; \
elif test $$(uname) = 'Linux'; then \
echo "pull Linux $@ file"; \
aws s3 cp s3://opcity-ds-scratch/guilherme/demos/dask_reading_group/setup/env_ubuntu18.04_20230203.txt ./$@; \
else \
echo "ERROR: Unrecognized architecture. Aborting."; \
exit 1; \
fi
@echo "DONE: downloading explicit conda environment file"
clean:
@echo "BEGIN: clearing files created in dask tutorial reading group"
conda env remove -n dask-tutorial
@echo "Removing files in this dir..."
@rm -rf dask-tutorial || true
@rm env*.txt || true
@rm env*.yml || true
@echo "Remove this folder to finish the cleanup"
@echo "END: clearing files created in dask tutorial reading group"
start:
cd dask-tutorial
export DASK_DISTRIBUTED__WORKER__MULTIPROCESSING_METHOD='fork' && jupyter lab --allow-root # or whatever command you use for a remote jupyter lab if in a remote machine
.PHONY: conda_env, clean, all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment