session
Classes¶
SexpWrapper
dataclass
¶
Lightweight handle for an R object stored in the worker.
The worker keeps the real rpy2 Sexp in an internal cache and replaces it in
results with this wrapper. When passed back to the worker, the wrapper is
resolved to the original Sexp again.
Notes
SexpWrapperinstances are only meaningful within the lifetime of the worker process that produced them. After a worker restart, previously returned wrappers can no longer be reattached.- This type exists to keep the main process free of rpy2 / embedded-R state.
PayloadRef
¶
Bases: TypedDict
Encoded argument/result payload sent over the control pipe.
A payload is:
codec: the codec identifier used by the registrymeta: JSON-serializable metadata needed to reconstruct the valuebuffers: shared-memory buffer references backing the payload
Request
¶
Bases: TypedDict
IPC request message sent from main process to worker.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Correlation id for the request/response pair. |
cmd |
{'CALL', 'SHUTDOWN', 'PING', '_RUN_TEST_BY_NAME'}
|
Command type. |
target |
str
|
Worker target spec (see |
args, kwargs |
Encoded arguments. |
Response
¶
Bases: TypedDict
IPC response message sent from worker back to the main process.
EnvironmentConfig
dataclass
¶
Worker environment configuration.
This configuration is applied in the worker before importing/using brms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
r_home
|
str or None
|
Override for |
None
|
startup_scripts
|
list[str]
|
R code snippets executed in the worker after initialization. |
list()
|
environment_name
|
str
|
brmspy environment name (used to determine |
'default'
|
runtime_path
|
str or None
|
Path to a brmspy runtime bundle to activate in the worker. |
None
|
env
|
dict[str, str]
|
Extra environment variables applied when spawning the worker. |
dict()
|
EncodeResult
dataclass
¶
Encoder
¶
Bases: Protocol
Protocol implemented by codecs in the session codec registry.