Skip to main content

Budget

Struct Budget 

Source
pub struct Budget {
    pub slice: String,
    pub memory_max: Option<u64>,
    pub memory_in_use: u64,
    pub admission: AdmissionPolicy,
    pub held: bool,
    pub mirror_memory: u64,
    pub seed_memory: Vec<SeedMemory>,
    pub shell_memory: Vec<ShellMemory>,
    pub host: Option<HostBudget>,
    pub cpu: Option<CpuBudget>,
    pub slice_cpus: Option<u64>,
}
Expand description

The memory budget runners and the mirror share, in bytes.

Fields§

§slice: String

The systemd slice runner containers run in.

§memory_max: Option<u64>

The slice’s MemoryMax; None when it is unlimited.

§memory_in_use: u64

Memory the running containers reserve: the runners’ caps, or under measured admission the larger of each runner’s predicted peak and its last sampled memory, and the caps of the seed containers, shells and the mirror.

§admission: AdmissionPolicy

What a new runner must fit in beside them.

§held: bool

Under measured admission, whether the slice is at the high-water mark, so no runner starts.

§mirror_memory: u64

The mirror’s part of memory_in_use: its cap while it is enabled or still running, else 0.

§seed_memory: Vec<SeedMemory>

The seed containers’ part of memory_in_use, one per profile that reseeds, by profile name.

§shell_memory: Vec<ShellMemory>

The shells’ part of memory_in_use, one per shell open in a record, by job.

§host: Option<HostBudget>

What the host’s memory leaves runners beside its other programs, from a recent reading of it; absent without one, and from a daemon before it read the host.

§cpu: Option<CpuBudget>

The CPU budget, under [host] cpu_overcommit. Absent without one, and from a daemon before CPU admission.

§slice_cpus: Option<u64>

The CPUs the slice may use, in millicores: its AllowedCPUs or the host’s, less under a lower CPUQuota, whether or not a CPU budget admits runners. The runners’ CPU limits are quotas that may add up past it. Absent when it could not be read, and from a daemon before it said.

Implementations§

Source§

impl Budget

Source

pub fn memory_reading(&self) -> Reading

What is reserved of what, as every client shows it: 8G of 24G reserved in runnerd.slice, or without MemoryMax 8G reserved in runnerd.slice, which has no MemoryMax; how runners are admitted (Budget::admission_note) follows the slice.

Source

pub fn clauses(&self) -> Vec<String>

The budget’s clauses in the order clients show them: memory (Budget::memory_reading), then CPU (CpuBudget::line) and the host (Budget::host_line) when the daemon reports them.

Source

pub fn host_line(&self) -> Option<String>

The host’s line as clients show it, such as host: 31G of 64G available, 1.5% stalled for memory; leaves the slice 40G; when that is less room than MemoryMax leaves (Budget::host_withheld), …; leaves the slice 25G of its 46G, so 6.5G is free, and without MemoryMax, where the host alone bounds it, …; leaves the slice 25G, so 6.5G is free; while it stalls, …; stalling, so no runner starts. While the slice is held (Budget::held), nothing is free, so it says no figure of it. With programs outside the slice large enough to name, …; programs outside CI hold 30G, most java 9.3G (HostMemory::outside_line). None without a recent reading of the host.

Source

pub fn host_withheld(&self) -> Option<u64>

What the host’s memory holds back of the room MemoryMax leaves beside what runs, in bytes: that room less what the host has to spare (HostBudget::spare), when the host leaves less. None while it leaves as much, while it stalls (its line says no runner starts), without a recent reading of it, and without MemoryMax.

Source

pub fn line(&self) -> String

The budget as one line, its clauses joined by ; .

Source

pub fn remaining(&self) -> Option<u64>

What MemoryMax leaves beside every running container’s reservation, in bytes: what a new runner must fit in. None without MemoryMax.

Source§

impl Budget

Source

pub fn admission_note(&self) -> Option<&'static str>

How runners are admitted, as clients add it to the budget’s line: nothing under caps, else by predicted peaks, and why nothing starts while the slice is at the high-water mark.

Trait Implementations§

Source§

impl Clone for Budget

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Budget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Budget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Budget

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Budget

Source§

impl PartialEq for Budget

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Budget

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Budget

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more