-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_model.sh
More file actions
54 lines (47 loc) · 1.83 KB
/
install_model.sh
File metadata and controls
54 lines (47 loc) · 1.83 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
#!/bin/bash
set -eo pipefail
# Remove other unneeded services
rm -rf /etc/supervisor/conf.d/*
mkdir -p /opt/workspace-internal/pytorch-model
mkdir -p /opt/supervisor-scripts
# ------------------------------------------------------------------------------
# Download model.py
# ------------------------------------------------------------------------------
curl -fsSL \
https://raw.githubusercontent.com/LucasArmandVast/example-worker/pytorch/model.py \
-o /opt/workspace-internal/pytorch-model/model.py
# ------------------------------------------------------------------------------
# Download model.sh
# ------------------------------------------------------------------------------
curl -fsSL \
https://raw.githubusercontent.com/LucasArmandVast/example-worker/pytorch/model.sh \
-o /opt/supervisor-scripts/model.sh
chmod +x /opt/supervisor-scripts/model.sh
# ------------------------------------------------------------------------------
# Add Supervisor application
# ------------------------------------------------------------------------------
cat > /etc/supervisor/conf.d/pytorch-model.conf << 'EOF'
# This program will always auto-start (no dependency on Portal config)
[program:pytorch-model]
environment=PROC_NAME="%(program_name)s"
command=/opt/supervisor-scripts/model.sh
autostart=true
autorestart=unexpected
exitcodes=0
startsecs=0
stopasgroup=true
killasgroup=true
stopsignal=TERM
stopwaitsecs=10
# This is necessary for Vast logging to work alongside the Portal logs
stdout_logfile=/dev/stdout
redirect_stderr=true
stdout_events_enabled=true
stdout_logfile_maxbytes=0
stdout_logfile_backups=0
EOF
# ------------------------------------------------------------------------------
# Reload Supervisor to pick up the new config
# ------------------------------------------------------------------------------
supervisorctl reread
supervisorctl update