Skip to content

Delete xc40 and spice #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions kgo_updates/kgo_update/kgo_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,8 @@ def _split_lines(self, text, width):
hostname = os.uname()[1]
if hostname == "uan01":
platform = "ex1a"
elif hostname.startswith("xc"):
platform = "xc40"
elif hostname.startswith("caz"):
platform = "azspice"
else:
platform = "spice"

# Make a connection to the database
conn = connect_to_kgo_database(suite_dir)
Expand Down Expand Up @@ -669,7 +665,7 @@ def _split_lines(self, text, width):
print(
f"\nThe kgo update for {platform} is complete.\n\nIf this was "
"run from 'meto_update_kgo.sh' in the UM, the generated files "
"will be moved to UMDIR on spice and the process will continue "
"will be moved to UMDIR on vdi and the process will continue "
"for other platforms requested.\n\nOtherwise, eg. for "
"lfric_inputs, you will need to merge the generated variables "
"file with the one in your working copy and run the script "
Expand Down
68 changes: 5 additions & 63 deletions kgo_updates/kgo_update/meto_run_kgo_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
# assumes is in the same directory. It takes suite name, suite user, version
# number, ticket number and required platforms as inputs. It runs the script on
# each platform as required and then moves the generated variables file to
# ~frum/kgo_updated_variables/vnVV.V_tTTTT/ on linux. IF xc40 is being run it
# rsyncs with the xcs.
# $UMDIR/kgo_updated_variables/vnVV.V_tTTTT/
# This script is NOT intended to be run independently of '../meto_update_kgo.sh'

# shellcheck disable=SC2059
Expand All @@ -22,12 +21,11 @@ GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Read in command line arguments
while getopts S:U:E:Z:N:R:P:V:F: flag
while getopts S:U:Z:N:R:P:V:F: flag
do
case "${flag}" in
S) suite_name=${OPTARG};;
U) suite_user=${OPTARG};;
E) suite_user_ex1a=${OPTARG};;
Z) ex_kgo_host=${OPTARG};;
N) new_kgo_dir=${OPTARG};;
R) new_release=${OPTARG};;
Expand All @@ -43,36 +41,14 @@ kgo_command="./kgo_update.py"
if [[ $new_release -eq 1 ]]; then
kgo_command="${kgo_command} --new-release"
fi
kgo_command="${kgo_command} -S $suite_name -N $new_kgo_dir -E $variables_extension"
kgo_command_spice="$kgo_command -U $suite_user -P spice"
kgo_command_azspice="$kgo_command -U $suite_user_ex1a -P azspice"
kgo_command_xc40="$kgo_command -U $suite_user -P xc40"
kgo_command_ex1a="$kgo_command -U $suite_user_ex1a -P ex1a"
kgo_command="${kgo_command} -S $suite_name -N $new_kgo_dir -E $variables_extension -U $suite_user"
kgo_command_azspice="$kgo_command -P azspice"
kgo_command_ex1a="$kgo_command -P ex1a"

# Make a directory to store the script and variables file file in
variables_dir=~/kgo_update_files/vn$version_number/$new_kgo_dir
mkdir -p "$variables_dir"

# If spice has kgo updates
if [[ $platforms == *"spice"* ]] && [[ $platforms != *"azspice"* ]]; then
printf "${GREEN}\n\nRunning KGO Update Script on spice.\n${NC}"

# Run the Update Script
if $kgo_command_spice; then
# Move the updated variables file and script into the ticket folder
printf "${GREEN}\n\nSuccessfully installed on spice.\n${NC}"
printf "${GREEN}Moving the generated files into spice ${variables_dir}.${NC}\n"
if [[ $new_release -ne 1 ]]; then
mv ~/"variables${variables_extension}_${new_kgo_dir}" \
"${variables_dir}/spice_updated_variables${variables_extension}"
fi
mv ~/"kgo_update_${new_kgo_dir}.sh" \
"${variables_dir}/spice_update_script.sh"
else
printf "${RED}\nThe installation script has failed on spice.\n${NC}"
fi
fi

# If azspice has kgo updates
if [[ $platforms == *"azspice"* ]]; then
printf "${GREEN}\n\nRunning KGO Update Script on azspice.\n${NC}"
Expand All @@ -93,40 +69,6 @@ if [[ $platforms == *"azspice"* ]]; then
fi
fi

# If xc40 has kgo updates
if [[ $platforms == *"xc40"* ]]; then
printf "${GREEN}\n\nRunning KGO Update Script on xc40.\n${NC}"

host_xc40=$(rose host-select xc)

# SCP the python script to the xc40
scp -q kgo_update.py "frum@${host_xc40}":~

# Define the commands to run on xc40
command=". /etc/profile ; module load scitools ;
${kgo_command_xc40}"

# SSH to the xc40 with the run command
if ssh -Y "$host_xc40" "$command"; then
# rsync the generated variables file and script back to frum on linux
# This cleans up the original files
printf "${GREEN}\n\nSuccessfully installed on xc40.\n${NC}"
printf "${GREEN}Rsyncing the generated files into spice ${variables_dir}.\n${NC}"
if [[ $new_release -ne 1 ]]; then
rsync --remove-source-files -avz \
"frum@$host_xc40:~/variables${variables_extension}_${new_kgo_dir}" \
"${variables_dir}/xc40_updated_variables${variables_extension}"
fi
rsync --remove-source-files -avz \
"frum@${host_xc40}:~/kgo_update_${new_kgo_dir}.sh" \
"${variables_dir}/xc40_update_script.sh"
else
printf "${RED}\nThe installation script has failed on xc40.\n${NC}"
fi

# Clean up kgo_update.py on xc40
ssh -Yq "$host_xc40" "rm kgo_update.py"
fi

# If ex1a has kgo updates
if [[ $platforms == *"ex1a"* ]]; then
Expand Down
Loading