Skip to content
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

vm setup/dismantle fixes #14

Merged
merged 5 commits into from
Nov 21, 2023
Merged
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
2 changes: 1 addition & 1 deletion main/dismantle_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi
source ${JSCRED}

# get volume id
volume_id=$(openstack server show $NAME -c volumes_attached -f json | jq -r '.volumes_attached[0].id')
volume_id=$(openstack server show blast00 -c volumes_attached -f json | jq -r '.volumes_attached | split("=")[1]')
# get corresponding ip address
ip_address=$(grep -A 5 $NAME $SSHCONFIG | grep "HostName" | awk '{print $2}')
# remove IP from instance
Expand Down
11 changes: 9 additions & 2 deletions main/setup_instance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ do
elapsed=$(( current_time - start_time ))

if [[ $elapsed -ge 300 ]]; then
echo "Timeout: SSH not ready after 5 minutes on $VMNAME$chunk."
echo "Timeout: SSH or Network not ready after 5 minutes on $VMNAME$chunk."
echo "Deleting server $VMNAME$chunk..."
./dismantle_instance.sh -j $JSCRED -h hostnames -m $VMNAME$chunk -c $SSHCONFIG -d $DATASOURCE
# del ip in case it wasn't attached
Expand All @@ -130,7 +130,14 @@ do

if ssh -i /home/$USER/.ssh/$PRIVATEKEY -o ConnectTimeout=5 -o StrictHostKeyChecking=no $USER@$ip_address echo "SSH is up" > /dev/null 2>&1; then
echo "SSH is ready on $VMNAME$chunk."
break
# Network check: Ping an external server to verify network connectivity
if ssh -i /home/$USER/.ssh/$PRIVATEKEY -o ConnectTimeout=5 -o StrictHostKeyChecking=no $USER@$ip_address ping -c 3 google.com > /dev/null 2>&1; then
echo "Network is up on $VMNAME$chunk."
break
else
echo "Network check failed on $VMNAME$chunk. Retrying..."
sleep 5
fi
else
echo "Still waiting for SSH on $VMNAME$chunk..."
sleep 5
Expand Down
2 changes: 1 addition & 1 deletion scheduler/servers/ben-servers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ declare -A SERVER_MAP

USER="ubuntu"
REMOTE_PATH=/etc/ben/ben
HOSTNAME="/home/ubuntu/crux/hostnames"
HOSTNAME="/home/ubuntu/t-rex-monitor/hostnames"

SERVER_MAP=(
["/tmp/ben-ecopcr"]="/tmp/ben-blast"
Expand Down
3 changes: 3 additions & 0 deletions scheduler/supabase/benparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
else:
key = line.split(" = ")[0].strip()
value = line.split(" = ")[1].strip()
if key == "command":
continue
job[key] = value
jobs.append(job)

# Filter out empty dictionaries
jobs = [d for d in jobs if d]
Expand Down