Skip to content

Commit 5333cbf

Browse files
thomasywangfacebook-github-bot
authored andcommitted
Configurable debounce (meta-pytorch#854)
Summary: When we increase the number of actors in our simulation it takes longer for all the events at a certain time to complete so we need to wait for longer. If we wait to long then the simulation just runs slower than it needs to so its nice to make this configurable. In the long term we will come up with a more robust solution to this but in the meantime that is not a priority. See EX528476 to understand the underlying problem the debounce is remedying Reviewed By: pablorfb-meta Differential Revision: D80137965
1 parent 4a05b1f commit 5333cbf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

hyperactor/src/simnet.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,23 @@ impl SimNet {
569569
let mut training_script_waiting_time = tokio::time::Duration::from_millis(0);
570570
// Duration elapsed while only non_advanceable_events has events
571571
let mut debounce_timer: Option<tokio::time::Instant> = None;
572+
573+
let debounce_duration = std::env::var("SIM_DEBOUNCE")
574+
.ok()
575+
.and_then(|val| val.parse::<u64>().ok())
576+
.unwrap_or(1);
577+
572578
'outer: loop {
573579
// Check if we should stop
574580
if stop_signal.load(Ordering::SeqCst) {
575581
break 'outer self.records.clone();
576582
}
577583

578584
while let Ok(Some((event, advanceable, time))) = RealClock
579-
.timeout(tokio::time::Duration::from_millis(1), event_rx.recv())
585+
.timeout(
586+
tokio::time::Duration::from_millis(debounce_duration),
587+
event_rx.recv(),
588+
)
580589
.await
581590
{
582591
let scheduled_event = match time {

0 commit comments

Comments
 (0)