Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ddab0d2600 | |||
| 50633c5003 |
+5
-29
@@ -222,42 +222,18 @@ if [ "$IS_DEPLOYMENT" = "true" ]; then
|
|||||||
DEPLOY_DIR="/workspace/deployment"
|
DEPLOY_DIR="/workspace/deployment"
|
||||||
mkdir -p "$DEPLOY_DIR"
|
mkdir -p "$DEPLOY_DIR"
|
||||||
|
|
||||||
# Download deployment code via instance API key
|
VAST_API_BASE="${VAST_API_BASE:-https://console.vast.ai}"
|
||||||
echo "Downloading deployment code..."
|
|
||||||
DOWNLOAD_RESPONSE=$(curl -sS \
|
|
||||||
-H "Authorization: Bearer $CONTAINER_API_KEY" \
|
|
||||||
"https://console.vast.ai/api/v0/deployment/${DEPLOYMENT_ID}/download_url/")
|
|
||||||
DOWNLOAD_URL=$(python3 -c "import sys,json; print(json.load(sys.stdin)['download_url'])" <<< "$DOWNLOAD_RESPONSE")
|
|
||||||
|
|
||||||
if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" = "None" ]; then
|
# Download deployment code, retrying until the blob is available on S3.
|
||||||
report_error_and_exit "Failed to get deployment download URL"
|
# The s3_key exists in the DB as soon as the deployment is created, but the
|
||||||
fi
|
# actual upload may still be in flight from the client side.
|
||||||
|
|
||||||
curl -sS -L "$DOWNLOAD_URL" -o "$DEPLOY_DIR/deployment.tar.gz"
|
|
||||||
cd "$DEPLOY_DIR" && tar xzf deployment.tar.gz
|
|
||||||
echo "Deployment code extracted."
|
|
||||||
|
|
||||||
# Source secrets if present
|
|
||||||
if [ -f "$DEPLOY_DIR/.secrets" ]; then
|
|
||||||
echo "Sourcing secrets..."
|
|
||||||
source "$DEPLOY_DIR/.secrets"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run on_start.sh to completion if present
|
|
||||||
if [ -f "$DEPLOY_DIR/on_start.sh" ]; then
|
|
||||||
echo "Running on_start.sh..."
|
|
||||||
chmod +x "$DEPLOY_DIR/on_start.sh"
|
|
||||||
bash "$DEPLOY_DIR/on_start.sh"
|
|
||||||
echo "on_start.sh completed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install SDK (uses the install_vastai_sdk function which supports SDK_BRANCH/SDK_VERSION)
|
# Install SDK (uses the install_vastai_sdk function which supports SDK_BRANCH/SDK_VERSION)
|
||||||
install_vastai_sdk
|
install_vastai_sdk
|
||||||
|
|
||||||
# Run deployment in serve mode
|
# Run deployment in serve mode
|
||||||
export VAST_DEPLOYMENT_MODE=serve
|
export VAST_DEPLOYMENT_MODE=serve
|
||||||
echo "Starting deployment: python3 $DEPLOY_DIR/deployment.py"
|
echo "Starting deployment: python3 $DEPLOY_DIR/deployment.py"
|
||||||
python3 "$DEPLOY_DIR/deployment.py"
|
serve-vast-deployment
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
# ─── End SDK Deployment Mode ───────────────────────────────────────────
|
# ─── End SDK Deployment Mode ───────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user