refactor: move runtime parsers into scripts/docker
- serve_runtime.py and train_runtime.py are host-side Docker helpers, so they join train-entrypoint.sh and lib/ under scripts/docker/ - scripts/tools/ now contains only in-container CLIs - update wrapper call sites, test import, and docker guide references
This commit is contained in:
@@ -17,7 +17,7 @@ scripts/serve.sh preflight, Compose wrapper, lifecycle
|
|||||||
└── server.py --config /run/astrai/serve.yaml
|
└── server.py --config /run/astrai/serve.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
`scripts/tools/serve_runtime.py` reads `runtime:` plus the two container-side
|
`scripts/docker/serve_runtime.py` reads `runtime:` plus the two container-side
|
||||||
values Compose needs (`server.port` for the port mapping, `server.device` for
|
values Compose needs (`server.port` for the port mapping, `server.device` for
|
||||||
the preflight GPU check). `scripts/tools/server.py --config` reads `server:`.
|
the preflight GPU check). `scripts/tools/server.py --config` reads `server:`.
|
||||||
Explicit CLI arguments to `server.py` override `server:` YAML values.
|
Explicit CLI arguments to `server.py` override `server:` YAML values.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ scripts/train.sh preflight, Compose wrapper, lifecycle, timer
|
|||||||
└── train.py --config /run/astrai/train.yaml
|
└── train.py --config /run/astrai/train.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
The two parsers deliberately own different sections. `scripts/tools/train_runtime.py`
|
The two parsers deliberately own different sections. `scripts/docker/train_runtime.py`
|
||||||
reads only `runtime`; `scripts/tools/train.py` reads only
|
reads only `runtime`; `scripts/tools/train.py` reads only
|
||||||
`model/data/parallel/training/ckpt/log`. Explicit trainer arguments after `--`
|
`model/data/parallel/training/ckpt/log`. Explicit trainer arguments after `--`
|
||||||
override training YAML values.
|
override training YAML values.
|
||||||
|
|||||||
+2
-2
@@ -46,7 +46,7 @@ load_config() {
|
|||||||
die "PyYAML is required on the host (install python3-yaml)"
|
die "PyYAML is required on the host (install python3-yaml)"
|
||||||
|
|
||||||
local exports
|
local exports
|
||||||
exports="$(python3 "${ROOT_DIR}/scripts/tools/serve_runtime.py" exports "${CONFIG_FILE}")" ||
|
exports="$(python3 "${ROOT_DIR}/scripts/docker/serve_runtime.py" exports "${CONFIG_FILE}")" ||
|
||||||
die "Failed to load runtime configuration"
|
die "Failed to load runtime configuration"
|
||||||
eval "${exports}"
|
eval "${exports}"
|
||||||
if [[ -n "${SERVE_JOB_NAME}" ]]; then
|
if [[ -n "${SERVE_JOB_NAME}" ]]; then
|
||||||
@@ -113,7 +113,7 @@ runtime_environment_args() {
|
|||||||
local pair
|
local pair
|
||||||
while IFS= read -r -d '' pair; do
|
while IFS= read -r -d '' pair; do
|
||||||
RUNTIME_ENV_ARGS+=(--env "${pair}")
|
RUNTIME_ENV_ARGS+=(--env "${pair}")
|
||||||
done < <(python3 "${ROOT_DIR}/scripts/tools/serve_runtime.py" environment "${CONFIG_FILE}")
|
done < <(python3 "${ROOT_DIR}/scripts/docker/serve_runtime.py" environment "${CONFIG_FILE}")
|
||||||
}
|
}
|
||||||
|
|
||||||
start_server() {
|
start_server() {
|
||||||
|
|||||||
+2
-2
@@ -51,7 +51,7 @@ load_config() {
|
|||||||
die "PyYAML is required on the host (install python3-yaml)"
|
die "PyYAML is required on the host (install python3-yaml)"
|
||||||
|
|
||||||
local exports
|
local exports
|
||||||
exports="$(python3 "${ROOT_DIR}/scripts/tools/train_runtime.py" exports "${CONFIG_FILE}")" ||
|
exports="$(python3 "${ROOT_DIR}/scripts/docker/train_runtime.py" exports "${CONFIG_FILE}")" ||
|
||||||
die "Failed to load runtime configuration"
|
die "Failed to load runtime configuration"
|
||||||
eval "${exports}"
|
eval "${exports}"
|
||||||
validate_job_name "${TRAIN_JOB_NAME}"
|
validate_job_name "${TRAIN_JOB_NAME}"
|
||||||
@@ -148,7 +148,7 @@ runtime_environment_args() {
|
|||||||
local pair
|
local pair
|
||||||
while IFS= read -r -d '' pair; do
|
while IFS= read -r -d '' pair; do
|
||||||
RUNTIME_ENV_ARGS+=(--env "${pair}")
|
RUNTIME_ENV_ARGS+=(--env "${pair}")
|
||||||
done < <(python3 "${ROOT_DIR}/scripts/tools/train_runtime.py" environment "${CONFIG_FILE}")
|
done < <(python3 "${ROOT_DIR}/scripts/docker/train_runtime.py" environment "${CONFIG_FILE}")
|
||||||
}
|
}
|
||||||
|
|
||||||
start_training() {
|
start_training() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from scripts.tools.serve_runtime import load_runtime
|
from scripts.docker.serve_runtime import load_runtime
|
||||||
|
|
||||||
|
|
||||||
def _write(tmp_path, body: str) -> str:
|
def _write(tmp_path, body: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user