Skip to content

Commit

Permalink
Don't start warmup period until target is running
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeHahn committed Sep 11, 2024
1 parent 7e2a045 commit db4cc92
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

###
### Changed
- Now built using rust 1.81.0.

### Fixed
- Warmup period is now respected when container targeting is in use.

## [0.23.1]
### Fixed
- Fixes a panic in the signal mechanism that appeared when using the file
Expand Down
30 changes: 20 additions & 10 deletions lading/src/bin/lading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use tokio::{
sync::broadcast,
time::{self, sleep, Duration},
};
use tracing::{debug, error, info, warn};
use tracing::{debug, error, info, info_span, warn, Instrument};
use tracing_subscriber::{fmt::format::FmtSpan, util::SubscriberInitExt, EnvFilter};

#[derive(thiserror::Error, Debug)]
Expand Down Expand Up @@ -474,6 +474,8 @@ async fn inner_main(
}
}

let mut sequence_tgt_recv = tgt_snd.subscribe();

let mut tsrv_joinset = tokio::task::JoinSet::new();
let mut osrv_joinset = tokio::task::JoinSet::new();
//
Expand All @@ -496,15 +498,23 @@ async fn inner_main(
};

let (timer_watcher, timer_broadcast) = lading_signal::signal();
tokio::spawn(async move {
info!("target is running, now sleeping for warmup");
sleep(warmup_duration).await;
experiment_started_broadcast.signal();
info!("warmup completed, collecting samples");
sleep(experiment_duration).await;
info!("experiment duration exceeded, signaling for shutdown");
timer_broadcast.signal();
});

tokio::spawn(
async move {
info!("waiting for target startup");
if let Err(e) = sequence_tgt_recv.recv().await {
warn!("failed to wait: {:?}", e);
}
info!("target is running, now sleeping for warmup");
sleep(warmup_duration).await;
experiment_started_broadcast.signal();
info!("warmup completed, collecting samples");
sleep(experiment_duration).await;
info!("experiment duration exceeded, signaling for shutdown");
timer_broadcast.signal();
}
.instrument(info_span!("experiment_sequence")),
);

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

0 comments on commit db4cc92

Please sign in to comment.