-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup-taskvine
executable file
·127 lines (99 loc) · 2.91 KB
/
setup-taskvine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#! /bin/bash
#
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ENVIRONMENT="${SCRIPT_DIR}/taskvine-env"
decho () {
echo "$@" 1>&2
}
verbose () {
echo "$@"
"$@"
return $?
}
find_conda () {
if [[ -x ${SCRIPT_DIR}/miniconda3/bin/conda ]]
then
echo ${SCRIPT_DIR}/miniconda3/bin/conda
elif which mamba >& /dev/null
then
which mamba
elif which conda >& /dev/null
then
which conda
elif [[ -x ${HOME}/miniconda3/bin/conda ]]
then
echo ${HOME}/miniconda3/bin/conda
else
set -e
decho "Could not find conda."
decho "Fetching miniconda..."
curl -C - -L -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 1>&2
decho "Installing miniconda at: ${SCRIPT_DIR}/miniconda3"
sh Miniconda3-latest-Linux-x86_64.sh -b -p ${SCRIPT_DIR}/miniconda3 -s 1>&2
set +e
echo ${SCRIPT_DIR}/miniconda3/bin/conda
fi
}
create_environment () {
conda_exe="$1"
path_env="$2"
spec="$3"
if [[ -d ${path_env} ]]
then
action=update
else
action=create
fi
echo "${action%?}ing environment..."
verbose $conda_exe env ${action} -p ${path_env} -f ${spec}
return $?
}
CONDA=$(find_conda)
echo using conda at $CONDA
if ! create_environment "${CONDA}" "${ENVIRONMENT}" environment.yml
then
decho "Could not create/update environment!"
exit 1
fi
source $(realpath "${ENVIRONMENT}/bin/activate")
# installing these packages from pip, and not conda because coffea is coming
# from a pip local install, otherwise conda complains.
pip install matplotlib
pip install pandas
mkdir -p git-repos
echo "Cloning coffea"
coffea=git-repos/coffea
if [[ -d ${coffea} ]]
then
(cd ${coffea} && git pull --quiet origin taskvine-tools)
else
git clone --quiet https://github.com/cooperative-computing-lab/coffea.git --branch taskvine-tools --single-branch ${coffea}
fi
echo "Installing coffea into taskvine-env"
pip install --quiet ${coffea}
echo "Cloning topcoffea into taskvine-env"
topcoffea=git-repos/topcoffea
if [[ -d ${topcoffea} ]]
then
(cd ${topcoffea} && git pull --quiet origin taskvine)
else
git clone --quiet https://github.com/cooperative-computing-lab/topcoffea.git --branch taskvine --single-branch ${topcoffea}
fi
echo "Installing topcoffea"
pip install --quiet ${topcoffea}
echo "Packing environment for remote execution..."
rm -f taskvine-env.tar.gz
if ! conda-pack --output taskvine-env.tar.gz
then
decho "Could not pack environment!"
exit 1
fi
ln -sf ../../taskvine-env.tar.gz experiments/fig-10.Independent-Tasks-vs-Shared-Mini-Tasks
ln -sf ../../taskvine-env.tar.gz experiments/fig-13a.TopEFT
cat <<EOF
TaskVine conda environment installed succesfully.
Activate the environment with:
source ./activate-environment
cd to experiments/fig-* directories to reproduce the papers results
EOF
exit 0