pub struct EnvManager { /* private fields */ }Expand description
Manages isolated Python environments for pipeline execution.
Implementations§
Source§impl EnvManager
impl EnvManager
Sourcepub fn new(base_dir: impl Into<PathBuf>, env_type: EnvType) -> Self
pub fn new(base_dir: impl Into<PathBuf>, env_type: EnvType) -> Self
A manager that keeps its environments under base_dir, one per
pipeline. The directory is created eagerly; if that fails,
EnvManager::ensure_env reports the real error at first use.
Sourcepub fn ensure_env(
&self,
pipeline_id: &str,
requirements: &str,
) -> Result<PathBuf>
pub fn ensure_env( &self, pipeline_id: &str, requirements: &str, ) -> Result<PathBuf>
Get or create an environment for a pipeline. Returns the path to the Python binary.
Sourcepub fn cleanup(&self, max_age: Duration) -> usize
pub fn cleanup(&self, max_age: Duration) -> usize
Remove unused environments older than max_age.
Sourcepub fn env_id_for(requirements: &str) -> String
pub fn env_id_for(requirements: &str) -> String
A stable environment id for a set of requirements.
Callers with no durable pipeline identity — a one-off plan, whose id
is a fresh timestamp — must key on this instead. Keying on the plan
id gave every plan its own venv and its own pip install, which is
unbounded: one short test suite left 17 GB of near-identical
environments behind.
Auto Trait Implementations§
impl Freeze for EnvManager
impl RefUnwindSafe for EnvManager
impl Send for EnvManager
impl Sync for EnvManager
impl Unpin for EnvManager
impl UnsafeUnpin for EnvManager
impl UnwindSafe for EnvManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more