-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathray_worker.bat
More file actions
57 lines (46 loc) · 1.42 KB
/
ray_worker.bat
File metadata and controls
57 lines (46 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@echo off
setlocal enabledelayedexpansion
REM Check if Docker is installed
where docker >nul 2>nul
if %ERRORLEVEL% neq 0 (
echo Docker is not installed. Please install Docker and try again.
exit /b 1
)
REM Check if the required arguments are provided
if "%~4"=="" (
echo Usage: %0 ^<head_node_ip^> ^<provider_id^> ^<username^> ^<password^>
exit /b 1
)
set HEAD_NODE_IP=%~1
set PROVIDER_ID=%~2
set USERNAME=%~3
set PASSWORD=%~4
REM Get the auth token
curl -s -X POST "http://67.205.167.215:8000/token" ^
-H "Content-Type: application/x-www-form-urlencoded" ^
-d "username=%USERNAME%&password=%PASSWORD%" > token_response.txt
set /p TOKEN_RESPONSE=<token_response.txt
del token_response.txt
REM Extract access token (simplified version)
for /f "tokens=2 delims=:," %%a in ('echo %TOKEN_RESPONSE% ^| findstr "access_token"') do (
set AUTH_TOKEN=%%a
set AUTH_TOKEN=!AUTH_TOKEN:"=!
)
if "!AUTH_TOKEN!"=="" (
echo Failed to get auth token. Please check your credentials.
echo Server response: %TOKEN_RESPONSE%
exit /b 1
)
echo Successfully obtained auth token.
REM Pull the custom Ray image
docker pull piyushaaryan/ioc:1.1
REM Run the Ray container
docker run --rm ^
--name ray-worker-%PROVIDER_ID% ^
--network host ^
--shm-size=1gb ^
-e RAY_ADDRESS="ray://%HEAD_NODE_IP%:10001" ^
-e PROVIDER_ID="%PROVIDER_ID%" ^
-e AUTH_TOKEN="%AUTH_TOKEN%" ^
piyushaaryan/ioc:1.0
endlocal