[WIP] Add an embedded Galaxy engine for package-installed Galaxy - #1690
[WIP] Add an embedded Galaxy engine for package-installed Galaxy#1690jmchilton wants to merge 17 commits into
Conversation
e53cc9c to
6ed760f
Compare
084ca07 to
2ba7125
Compare
Recommendation on Gravity and ownershipShort answer: I would not route Gravity's current abstraction is process and service orchestration. Its foreground Putting Gravity underneath I recommend this ownership split:
A separate Gravity-backed, package-installed subprocess engine is still worth prototyping. Benchmark its cold and warm startup against the embedded engine. It could be simpler and more robust because of process isolation, and might eventually be preferable if its latency is acceptable. It should be exposed as a distinct engine, however, rather than hidden as an implementation detail of I would also avoid creating a new Authorship: OpenAI Codex — GPT-5 (session date 2026-09-02). |
gravity has the subprocess setup, isn't that the right abstraction ? threads are going to be gil bound |
|
Why was codex convinced by your comment and not mine - it didn't even really buy GIL as a reason - it thought process isolation was the real benefit. I've told my agents "Look at mvdbeek's comments - he is smarter than me." enough times they've recorded in their memories I bet 😠😆. Anyway this is prototyped in #1691 as a separate engine. I guess it would be better to not have both though. The best argument against Gravity I think is that the webserver is a stop-gap right? I would love a core driving loop that just handles like actions and doesn't need any sort of web layer. Driving a tool submission -> preparation -> execute -> job finalize - could probably be easily done with some library code. Workflows would really need probably some sort of application loop - but we've done some structuring around this in core and it would be great. I don't think that goal should prevent this from using gravity in this modality though. |
Requires a release of Galaxy containing #23360.
Opening a WIP PR just because we've done a lot of work not a reflection of it being close to being ready. I really dislike the tests in here and I'm unsure if the Galaxy layer should be proxied through Gravity or not. A lot of the complexity in planemo/galaxy/embedded.py seems not particularly Planemo-specific and I wonder if Gravity or a new galaxy-launcher-library project could absorb the complexity and isolate it from Planemo. Rest of this writeup is agent stuff. -John
Summary
This adds an opt-in
--engine embedded_galaxymode forplanemo run,planemo test, and foregroundplanemo serve.Instead of cloning or launching a Galaxy checkout, the engine loads a coherent, package-installed Galaxy into Planemo's Python process. Planemo still talks to Galaxy through its existing HTTP/BioBlend interfaces, so tool execution, workflow execution, reporting, profiles, dependency resolution, and Tool Shed installation continue to use the established Planemo paths.
The engine is deliberately opt-in and does not change the existing
galaxy,docker_galaxy,external_galaxy, oruvx_galaxyengines.Motivation
The managed Galaxy engine provides strong isolation but pays for checkout and subprocess startup. Package-installed Galaxy can provide a substantially lighter authoring and testing loop if Planemo owns the complete in-process lifecycle and leaves no global state, worker, server, child process, or temporary configuration behind.
This work also makes YAML Galaxy tools valid
GalaxyToolrunnables, fixing the existing mismatch where discovery yielded YAML tool sources thatfor_path()later rejected.Implementation
embedded_galaxyin the engine factory and relevant CLI choices, with validation for unsupported checkout, daemon, non-loopback, and interactive-tool options.build_galaxy_web_app(..., register_shutdown_at_exit=False)and restores Galaxy's process-global application reference on every exit path.solopool and bothgalaxy.internalandgalaxy.externalqueues, using in-memory transport and the RPC result backend.Scope and limitations
Version 1 supports local tools and workflows, Tool Shed installs, profiles/PostgreSQL, and the existing Conda/container dependency resolvers.
It does not:
Test coverage
Fast lifecycle and configuration coverage includes:
Ctrl-Cbehavior;--no_cleanuppreservation;Opt-in tests against Galaxy packages built with #23360 prove:
planemo runoutput downloads in fresh subprocesses;planemo servereadiness and SIGINT cleanup; andLatest focused results:
Before marking ready for review
masterafter Planemo Honor Galaxy test timeouts across uploads and workflows #1687 merges and confirm the PR contains only the embedded-engine work.planemo[embedded_galaxy]with a one-series upper bound.galaxyandembedded_galaxy.tox -e mypycleanly.Suggested reviewer path
planemo/galaxy/embedded.pystartup, logging, and ordered teardown.