pub struct JobMemory { /* private fields */ }Expand description
A terminal’s view of the memory its jobs hold.
Implementations§
Source§impl JobMemory
impl JobMemory
Sourcepub const fn new(
jobs: JobRegistry,
reader: AnyFootprintReader,
registry: Option<AnyFootprintRegistry>,
window: ResponseWindow,
) -> Self
pub const fn new( jobs: JobRegistry, reader: AnyFootprintReader, registry: Option<AnyFootprintRegistry>, window: ResponseWindow, ) -> Self
The memory view of the jobs in jobs, of the machine the embedder
runs on.
Sourcepub fn with_container(self, container: AnyContainerMemory) -> Self
pub fn with_container(self, container: AnyContainerMemory) -> Self
Also judges the jobs that run in a container against the container’s
own memory limit, read through container.
Sourcepub const fn has_container(&self) -> bool
pub const fn has_container(&self) -> bool
Whether the jobs run in a container whose memory is read.
Sourcepub fn response_window(&self) -> Duration
pub fn response_window(&self) -> Duration
The response window, as it stands now.
Sourcepub async fn container_snapshot(
&self,
) -> Result<Option<ContainerSnapshot>, FootprintError>
pub async fn container_snapshot( &self, ) -> Result<Option<ContainerSnapshot>, FootprintError>
Reads the memory of the container the agent works in: its jobs against
the container’s limit, and its pressure. None when the terminal
runs in no container, or the container has no memory limit.
§Errors
Fails when the container cannot be read.
Sourcepub async fn snapshot(&self) -> Result<MemorySnapshot, FootprintError>
pub async fn snapshot(&self) -> Result<MemorySnapshot, FootprintError>
Reads the memory the running jobs of this machine hold, publishes the total to the registry and reads the other agents’ totals. Jobs in a container or on a remote host are not the machine’s.
§Errors
Fails when the host or the registry cannot be read.
Sourcepub async fn kill_runaway(
&self,
job: &JobFootprint,
snapshot: &MemorySnapshot,
) -> bool
pub async fn kill_runaway( &self, job: &JobFootprint, snapshot: &MemorySnapshot, ) -> bool
Kills the whole process tree of job, which reads
KillCause::MemoryRunaway afterwards.
Returns whether the job was running and is killed.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for JobMemory
impl !UnwindSafe for JobMemory
impl Forget for JobMemory
impl Freeze for JobMemory
impl Move for JobMemory
impl Send for JobMemory
impl Sync for JobMemory
impl Unpin for JobMemory
impl UnsafeUnpin for JobMemory
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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