Skip to content

Commit

Permalink
Merge pull request #14 from CALeDNA/develop
Browse files Browse the repository at this point in the history
vm setup/dismantle fixes
  • Loading branch information
hector-baez authored Nov 21, 2023
2 parents 115d3f2 + d8ef6ef commit 83129dd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
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

0 comments on commit 83129dd

Please sign in to comment.