pub struct SpectatorBuilder { /* private fields */ }
Expand description
Builder for the Spectator observer
§Example
use argmin_observer_spectator::SpectatorBuilder;
let spectator = SpectatorBuilder::new()
// Optional: Name the optimization run
// Default: random UUID.
.with_name("optimization_run_1")
// Optional, defaults to 127.0.0.1
.with_host("127.0.0.1")
// Optional, defaults to 5498
.with_port(5498)
// Choose which metrics should automatically be selected.
// If omitted, all metrics will be selected.
.select(&["cost", "best_cost"])
// Build Spectator observer
.build();
Implementations§
source§impl SpectatorBuilder
impl SpectatorBuilder
sourcepub fn with_name<T: AsRef<str>>(self, name: T) -> Self
pub fn with_name<T: AsRef<str>>(self, name: T) -> Self
Set a name the optimization run will be identified with
Defaults to a random UUID.
§Example
let builder = SpectatorBuilder::new().with_name("optimization_run_1");
sourcepub fn with_host<T: AsRef<str>>(self, host: T) -> Self
pub fn with_host<T: AsRef<str>>(self, host: T) -> Self
Set the host argmin spectator is running on.
Defaults to 127.0.0.1.
§Example
let builder = SpectatorBuilder::new().with_host("192.168.0.1");
sourcepub fn with_port(self, port: u16) -> Self
pub fn with_port(self, port: u16) -> Self
Set the port Spectator is running on.
Defaults to 5498.
§Example
let builder = SpectatorBuilder::new().with_port(1234);
sourcepub fn with_channel_capacity(self, capacity: usize) -> Self
pub fn with_channel_capacity(self, capacity: usize) -> Self
Set the channel capacity
A channel is used to queue messages for sending to Spectator. If the channel capacity is reached backpressure will be applied, effectively blocking the optimization. Defaults to 10000. Decrease this value in case memory consumption is too high and increase the value in case blocking causes negative effects.
§Example
let builder = SpectatorBuilder::new().with_channel_capacity(1000);
sourcepub fn select<T: AsRef<str>>(self, metrics: &[T]) -> Self
pub fn select<T: AsRef<str>>(self, metrics: &[T]) -> Self
Define which metrics will be selected in Spectator by default
If none are set, all metrics will be selected and shown. Providing zero or more metrics
via select
disables all apart from the provided ones. Note that independent of this
setting, all data will be sent, and metrics can be selected and deselected via the
Spectator GUI.
§Example
let builder = SpectatorBuilder::new().select(&["cost", "best_cost"]);
sourcepub fn channel_capacity(&self) -> usize
pub fn channel_capacity(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpectatorBuilder
impl RefUnwindSafe for SpectatorBuilder
impl Send for SpectatorBuilder
impl Sync for SpectatorBuilder
impl Unpin for SpectatorBuilder
impl UnwindSafe for SpectatorBuilder
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.