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

HPC: Merge old model setup with new job submission script #39

Merged
merged 2 commits into from
Dec 22, 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
28 changes: 24 additions & 4 deletions hpc/hq_scripts/job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,31 @@
#HQ --stdout none
#HQ --stderr none

# Launch model server, send back slurm job ID
# and wait to ensure that HQ won't schedule any more jobs to this allocation
# Launch model server, send back server URL
# and wait to ensure that HQ won't schedule any more jobs to this allocation.

/your/model/server/call & # CHANGE ME!
function get_avaliable_port {
# Define the range of ports to select from
MIN_PORT=1024
MAX_PORT=65535

# Generate a random port number
port=$(shuf -i $MIN_PORT-$MAX_PORT -n 1)

# Check if the port is in use
while lsof -Pi :$port -sTCP:LISTEN -t >/dev/null; do
# If the port is in use, generate a new random port number
port=$(shuf -i $MIN_PORT-$MAX_PORT -n 1)
done

port=4242
echo $port
}

port=$(get_avaliable_port)
export PORT=$port

# Assume that server sets the port according to the environment variable 'PORT'.
/your/model/server/call & # CHANGE ME!

load_balancer_dir="/load/balancer/directory" # CHANGE ME!

Expand All @@ -23,6 +42,7 @@ while ! curl -s "http://$host:$port/Info" > /dev/null; do
sleep 1
done

# Write server URL to file identified by HQ job ID.
mkdir -p "$load_balancer_dir/urls"
echo "http://$host:$port" > "$load_balancer_dir/urls/url-$HQ_JOB_ID.txt"

Expand Down
47 changes: 0 additions & 47 deletions hpc/hq_scripts/setup_model.sh

This file was deleted.