argmin_observer_spectator/
lib.rs

1// Copyright 2018-2024 argmin developers
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// http://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8//! This observer sends metrics and parameter vectors to a Spectator instance.
9//!
10//! ## Example
11//!
12//! ```
13//! use argmin_observer_spectator::SpectatorBuilder;
14//!
15//! let observer = SpectatorBuilder::new()
16//!     // Optional: Name the optimization run
17//!     // Default: random uuid.
18//!     .with_name("optimization_run_1")
19//!     // Optional, defaults to 127.0.0.1
20//!     .with_host("127.0.0.1")
21//!     // Optional, defaults to 5498
22//!     .with_port(5498)
23//!     // Choose which metrics should automatically be selected.
24//!     // If omitted, all metrics will be selected.
25//!     .select(&["cost", "best_cost"])
26//!     // Build Spectator observer
27//!     .build();
28//! ```
29//!
30//! The `observer`, when passed to `add_observer` of `Executor` sends metrics to a Spectator
31//! instance running on `127.0.0.1:5498`. For details on how to configure the observer the reader
32//! is referred to the documentation of [`SpectatorBuilder`].
33//! Make sure a Spectator instance is running when calling `.build()` on [`SpectatorBuilder`].
34//!
35//! # Usage
36//!
37//! Add the following line to your dependencies list:
38//!
39//! ```toml
40//! [dependencies]
41#![doc = concat!("argmin-observer-spectator = \"", env!("CARGO_PKG_VERSION"), "\"")]
42//! ```
43//!
44//! # License
45//!
46//! Licensed under either of
47//!
48//!   * Apache License, Version 2.0,
49//!     ([LICENSE-APACHE](https://github.com/argmin-rs/argmin/blob/main/LICENSE-APACHE) or
50//!     <http://www.apache.org/licenses/LICENSE-2.0>)
51//!   * MIT License ([LICENSE-MIT](https://github.com/argmin-rs/argmin/blob/main/LICENSE-MIT) or
52//!     <http://opensource.org/licenses/MIT>)
53//!
54//! at your option.
55//!
56//! ## Contribution
57//!
58//! Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion
59//! in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above,
60//! without any additional terms or conditions.
61
62mod observer;
63mod sender;
64
65pub use observer::SpectatorBuilder;