|
87 | 87 | rm -rf "$RELAY_DIR" |
88 | 88 | mkdir -p "$CMD_DIR" "$RESULT_DIR" |
89 | 89 |
|
90 | | -# Install modelopt in editable mode (skip if already editable-installed from WORKDIR) |
91 | | -if python -c " |
92 | | -import modelopt, os |
93 | | -assert os.path.realpath(modelopt.__path__[0]).startswith(os.path.realpath('$WORKDIR')) |
94 | | -" 2>/dev/null; then |
| 90 | +# Ensure modelopt is editable-installed from WORKDIR |
| 91 | +check_modelopt_local() { |
| 92 | + python -c " |
| 93 | +import modelopt, os, sys |
| 94 | +actual = os.path.realpath(modelopt.__path__[0]) |
| 95 | +expected = os.path.realpath('$WORKDIR') |
| 96 | +if not actual.startswith(expected): |
| 97 | + print(f'modelopt loaded from {actual}, expected under {expected}', file=sys.stderr) |
| 98 | + sys.exit(1) |
| 99 | +" 2>&1 |
| 100 | +} |
| 101 | + |
| 102 | +if check_modelopt_local >/dev/null 2>&1; then |
95 | 103 | echo "[server] modelopt already editable-installed from $WORKDIR, skipping pip install." |
96 | 104 | else |
97 | 105 | echo "[server] Installing modelopt (pip install -e .[dev]) ..." |
98 | | - (cd "$WORKDIR" && pip install -e ".[dev]") || { |
99 | | - echo "[server] WARNING: pip install failed (exit=$?), continuing anyway." |
100 | | - } |
| 106 | + (cd "$WORKDIR" && pip install -e ".[dev]") |
| 107 | + if ! check_modelopt_local; then |
| 108 | + echo "[server] ERROR: modelopt is not running from the local folder ($WORKDIR)." |
| 109 | + echo "[server] Try: pip install -e '.[dev]' inside the container, then restart the server." |
| 110 | + exit 1 |
| 111 | + fi |
101 | 112 | echo "[server] Install done." |
102 | 113 | fi |
103 | 114 |
|
@@ -130,7 +141,8 @@ while true; do |
130 | 141 |
|
131 | 142 | for cmd_file in "$CMD_DIR"/*.sh; do |
132 | 143 | cmd_id="$(basename "$cmd_file" .sh)" |
133 | | - echo "[server] Executing command $cmd_id..." |
| 144 | + cmd_content=$(cat "$cmd_file") |
| 145 | + echo "[server] Executing command $cmd_id: $cmd_content" |
134 | 146 |
|
135 | 147 | # Execute the command, tee stdout+stderr to console and result file |
136 | 148 | (cd "$WORKDIR" && bash "$cmd_file" 2>&1) | tee "$RESULT_DIR/$cmd_id.log" || true |
|
0 commit comments