Skip to main content

Daemon

Struct Daemon 

Source
pub struct Daemon {
    pub max_concurrent_runs: usize,
    pub pause_for_interrupts: bool,
}
Expand description

How the daemon loop itself behaves, as opposed to what one run does.

Machine-layer material in the same sense Repos::roots is: how many competitions this machine’s own loop is willing to babysit at once is a fact about the machine running magi serve, not about any one repository’s task, so it belongs in <config_dir>/magi/config.toml rather than a repository’s own magi.toml - though, like Repos::roots, nothing stops a repository from setting it too, since a scalar field takes whichever layer has the highest precedence.

Fields§

§max_concurrent_runs: usize

How many runs magi serve may have actively in flight at once. One by default - today’s behaviour, one run at a time.

This is a different knob from Graph::max_parallel, and the two must not be confused: max_parallel bounds how many agent processes one run starts inside itself (implementers, judges, reviewers - candidates competing on a single task); this field bounds how many runs - whole competitions, each with its own max_parallel budget - the loop drives side by side, possibly across different tasks and different repositories. Raising max_parallel buys a bigger panel for one task; raising this buys more tasks worked at once. A config file that meant one and wrote the other would either starve a competition of judges or leave the rest of the backlog waiting for no reason.

A run parked waiting on the operator’s land-merge approval - see crate::land - does not hold one of these slots while it waits: the whole point of parking there is to let the loop spend the slot on something runnable instead of sitting on a decision only a human can make. So even at the default of 1, an approval that comes back does not queue behind whatever else the loop happens to be running.

§pause_for_interrupts: bool

Let a task marked crate::queue::Task::interrupt (magi task interrupt) cut ahead of whatever magi serve already has in flight, instead of waiting for it to finish.

Off by default. When enabled, a run that is in flight and is not itself the interrupt candidate may be paused at its next safe node boundary - see crate::graph::Runner::park_here - so the marked task can run alone; the paused run resumes automatically, through the same path any other parked run does, the moment the interrupting task’s own run reaches a terminal status. This is opt-in because it bends the loop’s own “one run at a time” principle (see this repository’s magi serve help) for a specific, explicit operator request, and a repository that never files an interrupt task pays nothing for having it on - but an operator who does not want any run of theirs preempted, ever, should leave this false.

Trait Implementations§

Source§

impl Clone for Daemon

Source§

fn clone(&self) -> Daemon

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 Daemon

Source§

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

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

impl Default for Daemon

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for Daemon
where Daemon: Default,

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 Serialize for Daemon

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

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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