Skip to content

Commit 7e3b5db

Browse files
committed
Remove hardcoded cluster names from remote scripts
Security improvement: No longer default to tensor01/tensor02 (private clusters). Changes: - All 3 scripts now require --cluster flag (no default) - Removed tensor01/tensor02 from help text examples - Updated examples to use generic names (mycluster, gpucluster) - Added validation: scripts exit with error if --cluster not specified Users must explicitly specify their cluster name and create corresponding credentials file (.ssh/credentials_{cluster}.json) Related to #35
1 parent b48047a commit 7e3b5db

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

check_remote_status.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# completed models and estimates for in-progress training.
88
#
99
# Usage:
10-
# ./check_remote_status.sh [--cluster tensor01|tensor02]
10+
# ./check_remote_status.sh --cluster CLUSTER_NAME
1111
#
1212

1313
set -e
@@ -30,7 +30,7 @@ print_success() {
3030
}
3131

3232
# Default cluster
33-
CLUSTER="tensor02"
33+
CLUSTER="" # Must be specified with --cluster flag
3434

3535
# Parse arguments
3636
while [[ $# -gt 0 ]]; do
@@ -45,12 +45,11 @@ while [[ $# -gt 0 ]]; do
4545
echo "Check training status on remote GPU server"
4646
echo ""
4747
echo "Options:"
48-
echo " --cluster NAME Select cluster: tensor01 or tensor02 (default: tensor02)"
48+
echo " --cluster NAME Select cluster (required)"
4949
echo " -h, --help Show this help message"
5050
echo ""
5151
echo "Examples:"
52-
echo " $0 # Check status on tensor02 (default)"
53-
echo " $0 --cluster tensor01 # Check status on tensor01"
52+
echo " $0 --cluster mycluster # Check status on mycluster"
5453
exit 0
5554
;;
5655
*)
@@ -61,6 +60,13 @@ while [[ $# -gt 0 ]]; do
6160
esac
6261
done
6362

63+
# Validate cluster is specified
64+
if [ -z "$CLUSTER" ]; then
65+
print_error "Cluster must be specified with --cluster flag"
66+
echo "Example: $0 --cluster mycluster"
67+
exit 1
68+
fi
69+
6470
# Read credentials from config file
6571
CRED_FILE=".ssh/credentials_${CLUSTER}.json"
6672
if [ -f "$CRED_FILE" ]; then

remote_train.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ echo " -co, --content-only Train content-only variant"
8383
echo " -fo, --function-only Train function-only variant"
8484
echo " -pos, --part-of-speech Train part-of-speech variant"
8585
echo " -g, --max-gpus NUM Maximum number of GPUs to use (default: 4)"
86-
echo " --cluster NAME Select cluster: tensor01 or tensor02 (default: tensor02)"
86+
echo " --cluster NAME Select cluster (required: specify your cluster name)"
8787
echo
8888

8989
# Parse command line arguments
9090
KILL_MODE=false
9191
RESUME_MODE=false
9292
VARIANT_ARG=""
9393
MAX_GPUS=""
94-
CLUSTER="tensor02" # Default cluster
94+
CLUSTER="" # Must be specified with --cluster flag
9595

9696
while [[ $# -gt 0 ]]; do
9797
case $1 in
@@ -136,6 +136,14 @@ while [[ $# -gt 0 ]]; do
136136
esac
137137
done
138138

139+
# Validate cluster is specified
140+
if [ -z "$CLUSTER" ]; then
141+
print_error "Cluster must be specified with --cluster flag"
142+
echo "Example: $0 --cluster mycluster"
143+
echo "Create credentials file: .ssh/credentials_mycluster.json"
144+
exit 1
145+
fi
146+
139147
# Get server details - try to read from cluster-specific credentials file first
140148
CRED_FILE=".ssh/credentials_${CLUSTER}.json"
141149
if [ -f "$CRED_FILE" ]; then

sync_models.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ SYNC_BASELINE=false
2222
SYNC_CONTENT=false
2323
SYNC_FUNCTION=false
2424
SYNC_POS=false
25-
CLUSTER="tensor02" # Default cluster
25+
CLUSTER="" # Must be specified with --cluster flag
2626

2727
# Parse command line arguments (stackable)
2828
while [[ $# -gt 0 ]]; do
@@ -63,17 +63,12 @@ while [[ $# -gt 0 ]]; do
6363
echo " -fo, --function-only Sync function-only variant models"
6464
echo " -pos, --part-of-speech Sync part-of-speech variant models"
6565
echo " -a, --all Sync all models (baseline + all variants)"
66-
echo " --cluster CLUSTER Specify cluster (tensor01 or tensor02, default: tensor02)"
66+
echo " --cluster CLUSTER Specify cluster (required)"
6767
echo " -h, --help Show this help message"
6868
echo ""
69-
echo "Flags are stackable. Examples:"
70-
echo " $0 # Sync baseline only (default, tensor02)"
71-
echo " $0 -b -co # Sync baseline and content-only"
72-
echo " $0 -fo -pos # Sync function-only and POS"
73-
echo " $0 -a # Sync everything"
74-
echo " $0 -a --cluster tensor01 # Sync everything from tensor01"
75-
echo ""
76-
echo "Default: Sync baseline models only from tensor02"
69+
echo "Examples:"
70+
echo " $0 --cluster mycluster -a # Sync everything from mycluster"
71+
echo " $0 --cluster gpucluster -b -co # Sync baseline and content-only"
7772
exit 0
7873
;;
7974
*)
@@ -89,6 +84,14 @@ if [ "$SYNC_BASELINE" = false ] && [ "$SYNC_CONTENT" = false ] && [ "$SYNC_FUNCT
8984
SYNC_BASELINE=true
9085
fi
9186

87+
# Validate cluster is specified
88+
if [ -z "$CLUSTER" ]; then
89+
print_error "Cluster must be specified with --cluster flag"
90+
echo "Example: $0 --cluster mycluster -a"
91+
echo "Create credentials file: .ssh/credentials_mycluster.json"
92+
exit 1
93+
fi
94+
9295
echo "=================================================="
9396
echo " LLM Stylometry Model Sync"
9497
echo "=================================================="

0 commit comments

Comments
 (0)