primer_runtime¶
protoprimer execution runtimes¶
TODO: It seems like this concept of runtimes is redundant:
- python_executable cover python exec transition
- conf_leap covers configuration discovery
What does runtime explain?
Whether control is transferred outside of implementation done by protoprimer.
When does the transition from one runtime to another change?
Execution of user code.
There are a few primer runtimes:
proto= independent (stand-alone)This runtime runs proto_code.
It is designed to start outside of
venv(or inside arbitraryvenvwithoutprotoprimerpackage installed).Subsequently, it switches to initialized
venvwith installedprotoprimerand runsprotoprimer.primer_kernelmodule directly before switching tometaruntime eventually.metaThis runtime is client-specific (custom) setup that may perform any other setup (using packages in
venv).protoprimerpackage only implements transition into that runtime (proto->meta).But
protoprimerdoes not implementmetastates (they are out of its scope).metaprimerpackage implements states to be run inmetaruntime.These states can be run as is or customized by the client code.
Why do we need these runtimes?¶
The proto runtime must not import other non-standard packages (which are accessed via venv later) when it starts -
it runs a stand-alone proto_code
(limited only to the states defined there).
Any client-specific states only become accessible in meta runtime which starts
another python_executable.
How does transition from proto to meta runtimes work?¶
It relies on a helper function from proto_code used by the entry_script - see boot_vs_start.
Depending on whether it is venv or not (see primer_runtime),
the helper function passes control to different selected_main:
Outside
venv(without necessary packages), it executesselected_mainfromproto_kernel.Inside
venv(with necessary packages), it executesselected_mainfromclient_code.
It also requires CLI_compatibility.
How to specify target state available only in meta runtime?¶
See DAG_extension.