Skip to content

Commit bf0811b

Browse files
authored
docker: name the memory and scratch controls in the entrypoint's usage text (#543)
## What The release entrypoint's usage text is its header comment. This adds one paragraph that names the memory and scratch environment variables an operator can set (`PINEFORGE_COMMAND_SCRATCH_MAX_BYTES`, `PINEFORGE_COMMAND_SCRATCH_DIR` or `TMPDIR`, `PF_SCRATCH_ARENA_FD` with `PF_SCRATCH_ARENA_BYTES`, `PF_SCRATCH_ARENA_JAILED`, `PF_SCRATCH_WINDOW_BYTES`, `PINEFORGE_RUN_JSON_PROFILE`) and points to `docs/pages/memory-management.md` for defaults, units and limits. Comment-only: every code line of `docker/entrypoint.sh` is unchanged (nine comment lines are added before `set -euo pipefail`; no line is removed). Because the block moves the lines below it by nine, the `docker/entrypoint.sh:A-B` citations in `tests/ownership/driver.py` and `docs/design/BARS-BIN-INPUT.md` are re-pinned to the same lines of code (found by the text of the first and last line, not by adding nine blindly). The `driver.py` runtime-command citation was already one line stale on main (it named 287-300; the `run_json.py` call is 288-301 since the report-descriptor line was added at 263) and now names the right lines, so the five-line `driver.py` change is not a pure shift. ## Checks - Scope: three files; `git diff --summary` against the base is empty (no mode change); no code line of the entrypoint changes. - Each re-pinned citation names the same code as before (each read at the new file). - The documentation preflight guards (file:line anchors) run on the PR tree in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 53e884a commit bf0811b

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎docker/entrypoint.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@
8787
# into the work dir, or binding the request-feed inventory)
8888
# 4 backtest failure
8989
# 5 transpile failure (unsupported Pine construct or syntax error)
90+
#
91+
# Memory and scratch controls (environment): PINEFORGE_COMMAND_SCRATCH_MAX_BYTES
92+
# caps the bytes the command-store scratch may extend (one thread, in total);
93+
# PINEFORGE_COMMAND_SCRATCH_DIR or TMPDIR picks the disk-backed scratch directory;
94+
# PF_SCRATCH_ARENA_FD=5 with PF_SCRATCH_ARENA_BYTES supplies an inherited arena,
95+
# PF_SCRATCH_ARENA_JAILED=1 requires a sealed memfd, and PF_SCRATCH_WINDOW_BYTES
96+
# (default 32 MiB) caps what is mapped at once; PINEFORGE_RUN_JSON_PROFILE=jailed
97+
# selects the bounded-memory profile. Defaults, units and limits:
98+
# docs/pages/memory-management.md in the engine repository.
9099
set -euo pipefail
91100

92101
PREFIX="${PINEFORGE_PREFIX:-/opt/pineforge}"

‎docs/design/BARS-BIN-INPUT.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ docker/run_json.py:2350).
211211
This selection contract belongs to `run_json.py`. The container entrypoint
212212
still sets `OHLCV` to `/in/ohlcv.csv` (subject to its input-directory prefix)
213213
and invokes `--ohlcv`; renaming its mount alone does not switch routes
214-
(`OHLCV` docker/entrypoint.sh:96; `OHLCV` docker/entrypoint.sh:290).
214+
(`OHLCV` docker/entrypoint.sh:105; `OHLCV` docker/entrypoint.sh:299).
215215

216216
## 4. HPO
217217

‎tests/ownership/driver.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def discover_probes(root, only):
340340

341341

342342
def compile_command(prefix, cpp, so):
343-
# docker/entrypoint.sh:218-224, token for token; do not add or change flags.
343+
# docker/entrypoint.sh:227-233, token for token; do not add or change flags.
344344
return [
345345
"g++", "-std=c++17", "-O2", "-ffp-contract=off", "-fPIC", "-shared",
346346
f"-I{prefix}/include", "-I/usr/include/eigen3", str(cpp),
@@ -350,7 +350,7 @@ def compile_command(prefix, cpp, so):
350350

351351

352352
def runtime_command(run_json, work, options, *, phase_fd=None):
353-
# docker/entrypoint.sh:287-300, ordinary TRANSPILED=true route.
353+
# docker/entrypoint.sh:297-310, ordinary TRANSPILED=true route.
354354
command = [
355355
sys.executable, str(run_json), "--so", str(work / "strategy.so"),
356356
"--ohlcv", str(work / "bars.csv"),
@@ -371,7 +371,7 @@ def runtime_command(run_json, work, options, *, phase_fd=None):
371371

372372

373373
def bind_inventory_command(run_json, work, codegen):
374-
# docker/entrypoint.sh:238-242. The helper beside this run_json delegates
374+
# docker/entrypoint.sh:247-251. The helper beside this run_json delegates
375375
# all inventory validation/hashing to the explicitly selected codegen.
376376
helper = Path(run_json).with_name("bind_compiled_inventory.py")
377377
if not helper.is_file():
@@ -438,12 +438,12 @@ def transpile_worker(codegen, pine, cpp, diagnostic, inventory_out=None):
438438
return 5
439439
try:
440440
if inventory_out is None:
441-
# docker/entrypoint.sh:109-114. No support bypass, timeframe binding,
441+
# docker/entrypoint.sh:118-123. No support bypass, timeframe binding,
442442
# inventory API, or invented provenance file on this ordinary route.
443443
generated = transpile(Path(pine).read_text(encoding="utf-8"), filename="strategy.pine")
444444
Path(cpp).write_text(generated, encoding="utf-8")
445445
else:
446-
# docker/entrypoint.sh:139-146, including no primary_chart_timeframe
446+
# docker/entrypoint.sh:148-155, including no primary_chart_timeframe
447447
# binding. Serialize only the inventory returned by pinned codegen.
448448
result = transpile_with_request_inventory(
449449
Path(pine).read_text(encoding="utf-8"), filename="strategy.pine")

0 commit comments

Comments
 (0)