pub struct RunBuilder { /* private fields */ }Expand description
Implementations§
Source§impl RunBuilder
impl RunBuilder
pub fn run_id(self, id: RunId) -> Self
pub fn name(self, name: impl Into<String>) -> Self
pub fn project(self, name: impl Into<String>) -> Self
pub fn experiment(self, name: impl Into<String>) -> Self
pub fn user(self, id: UserId) -> Self
pub fn tag(self, tag: impl Into<String>) -> Self
pub fn wal_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn wal(self, wal: WalKind) -> Self
Sourcepub fn max_points_per_batch(self, n: usize) -> Self
pub fn max_points_per_batch(self, n: usize) -> Self
Examples found in repository?
examples/rust_api.rs (line 4)
1fn main() {
2 let mut run = photon::Run::builder()
3 .endpoint("[::1]:50051")
4 .max_points_per_batch(50)
5 .start()
6 .expect("failed to start run");
7
8 println!("Run: {}", run.id());
9
10 // Simulate a training loop
11 for step in 0..200 {
12 let loss = 1.0 / (1.0 + step as f64 * 0.05);
13 let accuracy = 1.0 - loss;
14
15 run.log("train/loss", loss, step).unwrap();
16 run.log("train/accuracy", accuracy, step).unwrap();
17
18 if step % 10 == 0 {
19 let lr = 0.001 * 0.95_f64.powi(step as i32 / 10);
20 run.log("train/lr", lr, step).unwrap();
21 }
22 }
23
24 println!("Logged: {} points", run.points_logged());
25
26 let stats = run.finish().expect("finish failed");
27
28 println!("\n--- Results ---");
29 println!("Points: {}", stats.points);
30 println!("Dropped: {}", stats.points_dropped);
31 println!("Batches: {}", stats.batches);
32 println!("Bytes (raw): {}", stats.bytes_uncompressed);
33 println!("Bytes (wire): {}", stats.bytes_compressed);
34 println!("Sent: {}", stats.batches_sent);
35 println!("Acked: {}", stats.batches_acked);
36
37 assert!(stats.batches > 0);
38 assert_eq!(stats.points, 420);
39 assert_eq!(stats.points_dropped, 0);
40
41 println!("\nAll checks passed!");
42}pub fn batch_interval(self, interval: Duration) -> Self
pub fn channel_capacity(self, cap: usize) -> Self
pub fn codec(self, codec: CodecKind) -> Self
pub fn compressor(self, compressor: CompressorKind) -> Self
pub fn transport(self, transport: TransportKind) -> Self
Sourcepub fn endpoint(self, url: impl Into<String>) -> Self
pub fn endpoint(self, url: impl Into<String>) -> Self
Examples found in repository?
examples/rust_api.rs (line 3)
1fn main() {
2 let mut run = photon::Run::builder()
3 .endpoint("[::1]:50051")
4 .max_points_per_batch(50)
5 .start()
6 .expect("failed to start run");
7
8 println!("Run: {}", run.id());
9
10 // Simulate a training loop
11 for step in 0..200 {
12 let loss = 1.0 / (1.0 + step as f64 * 0.05);
13 let accuracy = 1.0 - loss;
14
15 run.log("train/loss", loss, step).unwrap();
16 run.log("train/accuracy", accuracy, step).unwrap();
17
18 if step % 10 == 0 {
19 let lr = 0.001 * 0.95_f64.powi(step as i32 / 10);
20 run.log("train/lr", lr, step).unwrap();
21 }
22 }
23
24 println!("Logged: {} points", run.points_logged());
25
26 let stats = run.finish().expect("finish failed");
27
28 println!("\n--- Results ---");
29 println!("Points: {}", stats.points);
30 println!("Dropped: {}", stats.points_dropped);
31 println!("Batches: {}", stats.batches);
32 println!("Bytes (raw): {}", stats.bytes_uncompressed);
33 println!("Bytes (wire): {}", stats.bytes_compressed);
34 println!("Sent: {}", stats.batches_sent);
35 println!("Acked: {}", stats.batches_acked);
36
37 assert!(stats.batches > 0);
38 assert_eq!(stats.points, 420);
39 assert_eq!(stats.points_dropped, 0);
40
41 println!("\nAll checks passed!");
42}Sourcepub fn start(self) -> Result<Run, StartError>
pub fn start(self) -> Result<Run, StartError>
Examples found in repository?
examples/rust_api.rs (line 5)
1fn main() {
2 let mut run = photon::Run::builder()
3 .endpoint("[::1]:50051")
4 .max_points_per_batch(50)
5 .start()
6 .expect("failed to start run");
7
8 println!("Run: {}", run.id());
9
10 // Simulate a training loop
11 for step in 0..200 {
12 let loss = 1.0 / (1.0 + step as f64 * 0.05);
13 let accuracy = 1.0 - loss;
14
15 run.log("train/loss", loss, step).unwrap();
16 run.log("train/accuracy", accuracy, step).unwrap();
17
18 if step % 10 == 0 {
19 let lr = 0.001 * 0.95_f64.powi(step as i32 / 10);
20 run.log("train/lr", lr, step).unwrap();
21 }
22 }
23
24 println!("Logged: {} points", run.points_logged());
25
26 let stats = run.finish().expect("finish failed");
27
28 println!("\n--- Results ---");
29 println!("Points: {}", stats.points);
30 println!("Dropped: {}", stats.points_dropped);
31 println!("Batches: {}", stats.batches);
32 println!("Bytes (raw): {}", stats.bytes_uncompressed);
33 println!("Bytes (wire): {}", stats.bytes_compressed);
34 println!("Sent: {}", stats.batches_sent);
35 println!("Acked: {}", stats.batches_acked);
36
37 assert!(stats.batches > 0);
38 assert_eq!(stats.points, 420);
39 assert_eq!(stats.points_dropped, 0);
40
41 println!("\nAll checks passed!");
42}Trait Implementations§
Auto Trait Implementations§
impl Freeze for RunBuilder
impl RefUnwindSafe for RunBuilder
impl Send for RunBuilder
impl Sync for RunBuilder
impl Unpin for RunBuilder
impl UnsafeUnpin for RunBuilder
impl UnwindSafe for RunBuilder
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
Mutably borrows from an owned value. Read more