Repository navigation
perf(sync): render all skills in one bash process per adapter - #139
Closed
panesofglass wants to merge 1 commit into
Closed
panesofglass wants to merge 1 commit into
panesofglass wants to merge 1 commit into
Conversation
srp-engine.py --all spawned one bash (plus three jq) per skill×adapter: ~1,539 bash and ~4,600 jq processes from a single Python process. On a constrained Windows session that exhausts process-creation resources, so the run dies with STATUS_DLL_INIT_FAILED (0xC0000142) and then hangs on orphaned children (the failed spawn's descendants keep the stdio pipes open, so the caller blocks on EOF). Serialize every skill's IR once to a NUL-delimited stream and drive a small bash helper (adapter-render-all.sh) that sources one adapter and calls render_skill() in a loop. The rendering code is unchanged; the per-render jq calls and per-skill×adapter bash spawns are gone: before: 1,539 bash + ~4,600 jq (from one Python process) after: 19 bash + 0 jq Adapters without a stdin entrypoint (continue, omp, zed) keep no-opping, and a failing render_skill now exits non-zero so the engine aborts instead of hanging. Generated artifacts are byte-identical: a full --all on Windows leaves the tracked output unchanged (and no longer emits CRLF in rendered bodies, which the old native-jq path did). Refs danielvm-git#138.
Owner
|
|
Owner
|
Closing in favour of #155, which rebases your changes on top of #137 (merged). Your render_all approach is the right fix — the rebase only swaps the inline bash-resolution for the resolve_bash() function from #137 to keep both improvements. All your tests are included. Thank you for the excellent work, @panesofglass! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #138.
Problem
srp-engine.py --allspawned onebash(plus threejq) per skill×adapter — about 1,539bashand 4,600jqprocesses from a single Python process. On a constrained Windows session that exhausts process-creation resources: the run dies withSTATUS_DLL_INIT_FAILED(0xC0000142) and then hangs, because the failed spawn's orphaned descendants keep the stdio pipes open.bigpowers setupalways runs this step, so it affects every install.Change
_write_ir_stream).scripts/lib/adapter-render-all.sh: sources one adapter and calls itsrender_skill()for each record, in-process.render_all()spawns one bash per adapter; the IR no longer travels as JSON on stdin, so the per-renderjqcalls disappear.continue,omp,zed) still no-op, matching today's behaviour.render_skillexits non-zero, so the engine aborts instead of hanging.Verification
python3 tests/test_srp_engine.py— 26 tests OK; adds coverage for_write_ir_streamfield layout,render_allbatching (one process per adapter, not per skill×adapter), failure/missing-adapter exits, and the bash driver end-to-end.python3 scripts/lib/srp-engine.py --allwith thesync-skills.shenvironment on Windows: exit 0 andgit statusclean — the tracked generated artifacts are unchanged. The old path additionally emitted CRLF in rendered bodies on Windows (nativejqwriting text mode); this writes LF, matching the committed artifacts and CI.bash scripts/golden-g14-adapter-dispatch.sh— PASS (and--self-testPASS).Notes
--targetpath is unchanged.--allrender path).