Skip to main content

KernelOptions

Struct KernelOptions 

Source
pub struct KernelOptions {
    pub cwd: PathBuf,
    pub runtime_path: PathBuf,
    pub python: Option<PathBuf>,
    pub startup_timeout: Duration,
    pub limits: LimitOverrides,
    pub env: Vec<(String, String)>,
    pub snapshot_path: Option<PathBuf>,
    pub snapshot_key: Option<Vec<u8>>,
    pub continuity: Option<ContinuityPolicy>,
    pub sandbox: Option<Arc<Launcher>>,
    pub tree_memory: Option<TreeMemoryOptions>,
    pub base_env: Option<Vec<(String, String)>>,
}

Fields§

§cwd: PathBuf§runtime_path: PathBuf§python: Option<PathBuf>

Interpreter; default ULTRON_PYTHON, else /usr/bin/python3 when it exists, else python3.

§startup_timeout: Duration

Bounds initialization, not execution.

§limits: LimitOverrides

Overrides ULTRON_RLM_MAX_MEMORY_MB / ULTRON_RLM_MAX_CPU_SECONDS; 0 disables a limit.

§env: Vec<(String, String)>

Extra environment for the kernel, applied after the credential filter.

§snapshot_path: Option<PathBuf>

The default path of Kernel::snapshot / Kernel::restore; a new kernel restores it before its first call (kernel.ts snapshotPath).

§snapshot_key: Option<Vec<u8>>

HMAC key that signs and verifies snapshots in the host; the kernel never receives it. Default: a key of this process, so snapshots then restore only within it.

§continuity: Option<ContinuityPolicy>

Checkpoint after cells and recover from kernel death; requires snapshot_path.

§sandbox: Option<Arc<Launcher>>

Start runtime.py inside this launcher’s sandbox (the session’s bash policy, plus the snapshot and spill directories writable and the interpreter readable), so a cell’s direct open() is contained too. Docker cannot carry the protocol descriptors: with it (or nothing working) auto runs unsandboxed and required refuses to start. None: unsandboxed.

§tree_memory: Option<TreeMemoryOptions>

The whole-tree memory cap (kernel.ts maxTreeMemoryMb / treeMemoryBackend); None: no tree cap.

§base_env: Option<Vec<(String, String)>>

The environment the kernel starts from (before the credential filter) and where its ULTRON_* settings (ULTRON_PYTHON, limits, output budget, tree memory) are read: a session’s own environment, so the kernel never sees the server process’s PATH or variables. None: this process’s environment.

Implementations§

Source§

impl KernelOptions

Source

pub fn new(cwd: impl Into<PathBuf>, runtime_path: impl Into<PathBuf>) -> Self

Source

pub fn var(&self, name: &str) -> Option<String>

name in the kernel’s base environment (KernelOptions::base_env, else this process’s).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.