Skip to content

Commit

Permalink
Merge branch 'refs/heads/devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
sunset666 committed Sep 13, 2024
2 parents a4c0d4e + 6c18933 commit e4103ce
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
39 changes: 31 additions & 8 deletions src/ingest-pipeline/misc/tools/auto_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@

# What variables do we need?
# Define HIVE machines
#hive_machines=("l001.hive.psc.edu" "gpu002.pvt.hive.psc.edu")
# hive_machines=("l001.hive.psc.edu" "gpu002.pvt.hive.psc.edu")
hive_machines=()
#b2_machines=("v004.pvt.bridges2.psc.edu")
# b2_machines=("v004.pvt.bridges2.psc.edu")
b2_machines=()
repo_env="dev"
repo_dir="/opt/repositories/$(hostname -s)-$repo_env/ingest-pipeline"

priority_list=("-prod" "-test" "-dev")
base_name="airflow"
file_dir="/etc/sysconfig"

regenerate_env=false

function set_main_environment(){
for ending in "${priority_list[@]}"; do
file="$file_dir/$base_name$ending"
if [ -f "$file" ]; then
echo "Selected file: $file"
source $file
repo_env="$HUBMAP_INSTANCE"
python_version="$HUBMAP_PYTHON_VERSION"
repo_dir="/opt/repositories/$(hostname -s)-$repo_env/ingest-pipeline"
break
fi
done
}

while getopts ":g" opt; do
case $opt in
g)
Expand All @@ -23,23 +39,30 @@ while getopts ":g" opt; do
done

set -x
for machine in ${hive_machines[@]}; do

set_main_environment

if [ -z "$repo_env" ]; then
exit "The environment variable HUBMAP_INSTANCE is not set."
fi

for machine in "${codcc_machines[@]}"; do
# Rsync repo to machine
rsync -a --exclude "src/ingest-pipeline/airflow/logs" $repo_dir/ $machine:$repo_dir

# If flag set, run the conda environment regenerations
if $regenerate_env ; then
ssh $machine "/usr/local/bin/update_hubmap.sh $repo_dir $repo_env"
ssh $machine "/usr/local/bin/update_hubmap.sh $repo_dir $repo_env $python_version"
fi
done

# Separate because its easier to loop twice over a small list than insert string checking and manipulation
for machine in ${b2_machines[@]}; do
for machine in "${b2_machines[@]}"; do
# Rsync repo to machine
rsync -a --exclude "src/ingest-pipeline/airflow/logs" 'ssh -J bridges2.psc.edu' $repo_dir/ $machine:$repo_dir

# If flag set, run the conda environment regenerations
if $regenerate_env ; then
ssh -J "bridges2.psc.edu" $machine "/usr/local/bin/update_hubmap.sh $repo_dir $repo_env"
ssh -J "bridges2.psc.edu" $machine "/usr/local/bin/update_hubmap.sh $repo_dir $repo_env $python_version"
fi
done

0 comments on commit e4103ce

Please sign in to comment.