Skip to content

Commit

Permalink
binder env
Browse files Browse the repository at this point in the history
  • Loading branch information
AngryMaciek committed Mar 8, 2024
1 parent 07d16c6 commit 1a23868
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ resources/demon_model/src/demon.cpp \
-I/srv/conda/envs/notebook/include/ \
-lm

bash ../prepare-environments.sh
bash prepare-environments.sh
39 changes: 39 additions & 0 deletions binder/prepare-environments.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
###############################################################################
#
# Create internal conda envs with all dependencies
#
# AUTHOR: Maciej_Bak
# CONTACT: wsciekly.maciek@gmail.com
#
###############################################################################

# exit at a first command that exits with a !=0 status
set -eo pipefail

$CONDA_PREFIX/bin/snakemake \
--snakefile="workflow/Snakefile" \
--configfile="tests/localtest/config-template.yml" \
--config workflow_repo_path="$PWD" workflow_analysis_outdir="$PWD/tests/localtest/output" \
--use-conda \
--conda-create-envs-only \
--conda-frontend=conda \
--cores 1 \
--nolock \
all

for file in .snakemake/conda/*.yaml; do
if [ -f "$file" ]; then
if grep -q "name: warlock-r" "$file"; then
ENVPATH="${file%.yaml}"
break
fi
fi
done

eval "$(conda shell.bash hook)"
conda deactivate
conda activate $ENVPATH

# strange error often appears, installation needs to be called twice
Rscript -e "devtools::install('resources/demonanalysis', upgrade=TRUE)" || true
Rscript -e "devtools::install('resources/demonanalysis', upgrade=TRUE)" || true

0 comments on commit 1a23868

Please sign in to comment.