Skip to content

Commit c9a9b7c

Browse files
committed
Added port flag to run script
1 parent 586349a commit c9a9b7c

File tree

1 file changed

+55
-8
lines changed

1 file changed

+55
-8
lines changed

run.sbatch

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,70 @@
33
#SBATCH --job-name=comfyUI
44
#SBATCH --ntasks=1
55
#SBATCH --nodes=1
6-
#SBATCH --gres=gpu:1
6+
#SBATCH --gres=gpu:h100pcie:1
77
#SBATCH --cpus-per-task=8
88
#SBATCH --mem=128G
9-
#SBATCH --account=cai_ivs
10-
#SBATCH --partition=gpu_top
11-
12-
#SBATCH --output=/cluster/home/denp/logs/%x.id%j.%N.sbatch.out
13-
#SBATCH --error=/cluster/home/denp/logs/%x.id%j.%N.sbatch.err
9+
#SBATCH --account=cai_teaching
10+
#SBATCH --nodelist=sanjose
11+
#SBATCH --partition=teaching
12+
#SBATCH --output=/cluster/projects/2025_image_tools/logs/%x.id%j.%N.sbatch.out
13+
#SBATCH --error=/cluster/projects/2025_image_tools/logs/%x.id%j.%N.sbatch.err
1414
# #SBATCH --signal=B:SIGUSR1@900
1515

16+
usage() {
17+
cat <<EOF
18+
Usage: $0 [-p|--port <in>] [-h|--help]
19+
20+
This is a SLURM batch script for deploying comfyUI.
21+
22+
Options:
23+
-p, --port Port for the server.
24+
-h, --help Print this message.
25+
EOF
26+
}
27+
28+
1629
# Defaults
1730
CU_MODULE=cuda/12.8.0
1831
PY_MODULE=python/3.13.2
1932
UV_MODULE=uv/0.6.12
2033
ENV_NAME="comfy-ui" # define python virtualenv name
21-
PKG_DIR="/cluster/home/denp/comfyUI"
22-
PORT=8623
34+
PKG_DIR="/cluster/projects/2025_image_tools/comfyUI"
35+
PORT="${PORT:-9102}"
36+
37+
# Parse args
38+
OPTS=$(getopt -o p:h --long help,port: -- "$@")
39+
if [ $? != 0 ] ; then
40+
echo "[`date '+%Y-%m-%d %T.%3N'`][SLURM] - Failed to parse arguments." >&2
41+
exit 1
42+
fi
43+
eval set -- "$OPTS"
44+
45+
while true; do
46+
case "$1" in
47+
-p|--port)
48+
PORT="$2"
49+
shift 2
50+
;;
51+
-h|--help)
52+
usage
53+
exit 0
54+
;;
55+
--)
56+
shift
57+
break
58+
;;
59+
*)
60+
shift
61+
;;
62+
esac
63+
done
64+
# Required arguments
65+
if [[ $PORT -ge 8500 && $PORT -le 9100 ]]; then
66+
echo "Port $PORT is within the allowed range."
67+
else
68+
echo "Port $PORT is outside the allowed range."
69+
fi
2370

2471
# load modules
2572
module load "$CU_MODULE"

0 commit comments

Comments
 (0)