Page MenuHomec4science

cryosparc_install.sh
No OneTemporary

File Metadata

Created
Mon, May 23, 23:42

cryosparc_install.sh

#!/bin/bash
set -euo pipefail
# Script made from the page
# https://docs.ycrc.yale.edu/clusters-at-yale/guides/cryosparc/
script_path=$(dirname "$0") # relative
script_path=$(cd "${script_path}" && pwd) # absolutized and normalized
license_id=
install_path="$HOME"/cryosparc
# set up some more paths
db_path=${install_path}/database
worker_path=${install_path}/cryosparc2_worker
# Usage
usage () {
echo "Usage:"
echo " -p install path : prefix for installation [${install_path}] "
echo " -v : be verbose"
echo " -h : print this notice"
echo ""
}
VERBOSE=false
read -p "Enter your license id: " license_id
# Parse options
while getopts ":p:vh" opt; do
case $opt in
p)
install_path="${OPTARG}"
;;
v)
VERBOSE=true
;;
h)
usage
OPTIND=1
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
OPTIND=1
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
usage
OPTIND=1
exit 1
;;
esac
done
# Reset OPTIND to allow the next invocation to work
OPTIND=1
message() {
if $VERBOSE
then
echo "${1}"
fi
}
if [ "x${license_id}" == "x" ]; then
echo "[Error] No license id was provided" >&2
usage
exit 2
fi
message "[Info] Preparing the install path and dowloading cryosparc_master and cryosparc_worker"
# go get the installers
mkdir -p $install_path
cd $install_path
# Download master
curl -sL -C - -\# https://get.cryosparc.com/download/master-latest/$license_id -o cryosparc2_master.tar.gz
# Download worker
curl -sL -C - -\# https://get.cryosparc.com/download/worker-latest/$license_id -o cryosparc2_worker.tar.gz
message "[Info] Expanding tarballs"
tar -xf cryosparc2_master.tar.gz
tar -xf cryosparc2_worker.tar.gz
module purge
module load gcc cuda/11.0.2 python
message "[Info] Installing master"
cd ${install_path}/cryosparc_master
./install.sh --license $license_id --hostname $(hostname) --dbpath $db_path --yes
set +u
#source ~/.bashrc
set -u
message "[Info] Installing worker"
cd ${install_path}/cryosparc_worker
./install.sh --license $license_id --cudapath $CUDA_HOME --yes
set +u
#source ~/.bashrc
set -u
message "[Info] Creating worker configs"
cryosparc_master_path=${install_path}/cryosparc_master
if [ $(grep -c "export PATH" ${cryosparc_master_path}/config.sh) -eq 0 ]; then
echo "export PATH=${cryosparc_master_path}/bin:\$PATH" >> ${cryosparc_master_path}/config.sh
fi
if [ $(grep -c "export CRYOSPARC_HOSTNAME_CHECK" ${cryosparc_master_path}/config.sh) -eq 0 ]; then
echo "export CRYOSPARC_HOSTNAME_CHECK=${HOSTNAME}" >> ${cryosparc_master_path}/config.sh
fi
cryosparc_worker_path=${install_path}/cryosparc_worker
if [ $(grep -c "export PATH" ${cryosparc_worker_path}/config.sh) -eq 0 ]; then
echo "export PATH=${cryosparc_worker_path}/bin:\$PATH" >> ${cryosparc_worker_path}/config.sh
fi
cp ${script_path}/cryosparcm.sh ${install_path}/cryosparc_master/bin
${script_path}/create_user_and_lanes.sh -p ${install_path}

Event Timeline