Skip to content

Commit db4cc92

Browse files
committed
Don't start warmup period until target is running
1 parent 7e2a045 commit db4cc92

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## Unreleased
8-
9-
###
8+
### Changed
109
- Now built using rust 1.81.0.
1110

11+
### Fixed
12+
- Warmup period is now respected when container targeting is in use.
13+
1214
## [0.23.1]
1315
### Fixed
1416
- Fixes a panic in the signal mechanism that appeared when using the file

lading/src/bin/lading.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use tokio::{
2929
sync::broadcast,
3030
time::{self, sleep, Duration},
3131
};
32-
use tracing::{debug, error, info, warn};
32+
use tracing::{debug, error, info, info_span, warn, Instrument};
3333
use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt, EnvFilter};
3434

3535
#[derive(thiserror::Error, Debug)]
@@ -474,6 +474,8 @@ async fn inner_main(
474474
}
475475
}
476476

477+
let mut sequence_tgt_recv = tgt_snd.subscribe();
478+
477479
let mut tsrv_joinset = tokio::task::JoinSet::new();
478480
let mut osrv_joinset = tokio::task::JoinSet::new();
479481
//
@@ -496,15 +498,23 @@ async fn inner_main(
496498
};
497499

498500
let (timer_watcher, timer_broadcast) = lading_signal::signal();
499-
tokio::spawn(async move {
500-
info!("target is running, now sleeping for warmup");
501-
sleep(warmup_duration).await;
502-
experiment_started_broadcast.signal();
503-
info!("warmup completed, collecting samples");
504-
sleep(experiment_duration).await;
505-
info!("experiment duration exceeded, signaling for shutdown");
506-
timer_broadcast.signal();
507-
});
501+
502+
tokio::spawn(
503+
async move {
504+
info!("waiting for target startup");
505+
if let Err(e) = sequence_tgt_recv.recv().await {
506+
warn!("failed to wait: {:?}", e);
507+
}
508+
info!("target is running, now sleeping for warmup");
509+
sleep(warmup_duration).await;
510+
experiment_started_broadcast.signal();
511+
info!("warmup completed, collecting samples");
512+
sleep(experiment_duration).await;
513+
info!("experiment duration exceeded, signaling for shutdown");
514+
timer_broadcast.signal();
515+
}
516+
.instrument(info_span!("experiment_sequence")),
517+
);
508518

509519
// We must be sure to drop any unused watcher at this point. Below in
510520
// `signal_and_wait` if a watcher remains derived from `shutdown_watcher` the run will not shut down.

0 commit comments

Comments
 (0)