改爲手動添加服務器
This commit is contained in:
11
test.sh
11
test.sh
@@ -68,9 +68,14 @@ response=$(curl -X PATCH -H "Content-Type: application/json" -d '{"images":["htt
|
||||
message "$response" "修改數據集"
|
||||
|
||||
|
||||
# 添加服務器 (POST /api/servers)
|
||||
response=$(curl -X POST -H "Content-Type: application/json" -d '{"name":"GPU-T4","type":"訓練","ip":"106.15.192.42","port":7860}' -b "session_id=$session_id" -s -w "%{http_code}" http://localhost:8080/api/servers)
|
||||
message "$response" "添加服務器"
|
||||
|
||||
|
||||
# 服務器列表
|
||||
response=$(curl -X GET -b "session_id=$session_id" -s -w "%{http_code}" http://localhost:8080/api/servers)
|
||||
message "$response" "服務器列表" true
|
||||
message "$response" "服務器列表"
|
||||
|
||||
|
||||
# 創建模型訓練任務 (POST /api/models)
|
||||
@@ -92,8 +97,8 @@ while true; do
|
||||
message "$response" "獲取模型訓練進度 $progress% $status"
|
||||
# 如果進度爲 100, 訓練完成, 跳出循環
|
||||
[[ $progress -eq 100 ]] && { echo "訓練完成"; break; }
|
||||
# 測試訓練時間不超過20秒, 超過則退出
|
||||
[[ $(($(date +%s) - $start_time)) -gt 20 ]] && exit_service "訓練時間超過20秒"
|
||||
# 測試訓練時間不超過10秒, 超過則退出
|
||||
[[ $(($(date +%s) - $start_time)) -gt 10 ]] && exit_service "訓練時間超過20秒"
|
||||
# 休眠 3 秒
|
||||
sleep 3
|
||||
done
|
||||
|
Reference in New Issue
Block a user