Skip to content

Commit 665710e

Browse files
edward-shenfacebook-github-bot
authored andcommitted
Replace Duration::from_secs(60) to Duration::from_mins(1) (meta-pytorch#2066)
Summary: X-link: meta-pytorch/torchft#297 Rust 1.91 introduced `Duration::from_mins`. This diff replaces some instances of `Duration::from_secs` with the corresponding `Duration::from_mins`. Reviewed By: dtolnay Differential Revision: D88434166
1 parent 0481913 commit 665710e

9 files changed

Lines changed: 14 additions & 14 deletions

File tree

hyperactor/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ mod tests {
182182
let config = from_env();
183183

184184
assert_eq!(config[CODEC_MAX_FRAME_LENGTH], 1024);
185-
assert_eq!(config[MESSAGE_DELIVERY_TIMEOUT], Duration::from_secs(60));
185+
assert_eq!(config[MESSAGE_DELIVERY_TIMEOUT], Duration::from_mins(1));
186186
assert_eq!(
187187
config[MESSAGE_ACK_TIME_INTERVAL],
188188
Duration::from_millis(500)

hyperactor_config/src/global.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,10 +957,10 @@ mod tests {
957957
let orig_value = std::env::var("HYPERACTOR_MESSAGE_DELIVERY_TIMEOUT").ok();
958958
{
959959
let _guard1 = config.override_key(CODEC_MAX_FRAME_LENGTH, 4096);
960-
let _guard2 = config.override_key(MESSAGE_DELIVERY_TIMEOUT, Duration::from_secs(60));
960+
let _guard2 = config.override_key(MESSAGE_DELIVERY_TIMEOUT, Duration::from_mins(1));
961961

962962
assert_eq!(get(CODEC_MAX_FRAME_LENGTH), 4096);
963-
assert_eq!(get(MESSAGE_DELIVERY_TIMEOUT), Duration::from_secs(60));
963+
assert_eq!(get(MESSAGE_DELIVERY_TIMEOUT), Duration::from_mins(1));
964964
// This was overridden:
965965
assert_eq!(
966966
std::env::var("HYPERACTOR_MESSAGE_DELIVERY_TIMEOUT").unwrap(),

hyperactor_config/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ mod tests {
284284
env_name: Some("TEST_DURATION_KEY".to_string()),
285285
py_name: None,
286286
})
287-
pub attr DURATION_KEY: std::time::Duration = std::time::Duration::from_secs(60);
287+
pub attr DURATION_KEY: std::time::Duration = std::time::Duration::from_mins(1);
288288

289289
@meta(CONFIG = ConfigAttr {
290290
env_name: Some("TEST_MODE_KEY".to_string()),

hyperactor_mesh/src/alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ pub mod test_utils {
681681
extern "C" fn exit_handler() {
682682
loop {
683683
#[allow(clippy::disallowed_methods)]
684-
std::thread::sleep(Duration::from_secs(60));
684+
std::thread::sleep(Duration::from_mins(1));
685685
}
686686
}
687687

hyperactor_mesh/src/alloc/remoteprocess.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,7 +1927,7 @@ mod test {
19271927
let config = hyperactor_config::global::lock();
19281928
let _guard = config.override_key(
19291929
hyperactor::config::REMOTE_ALLOCATOR_HEARTBEAT_INTERVAL,
1930-
Duration::from_secs(60),
1930+
Duration::from_mins(1),
19311931
);
19321932
hyperactor_telemetry::initialize_logging_for_test();
19331933
let serve_addr = ChannelAddr::any(ChannelTransport::Unix);
@@ -2029,7 +2029,7 @@ mod test {
20292029
let config = hyperactor_config::global::lock();
20302030
let _guard = config.override_key(
20312031
hyperactor::config::REMOTE_ALLOCATOR_HEARTBEAT_INTERVAL,
2032-
Duration::from_secs(60),
2032+
Duration::from_mins(1),
20332033
);
20342034
hyperactor_telemetry::initialize_logging(ClockKind::default());
20352035
let serve_addr = ChannelAddr::any(ChannelTransport::Unix);
@@ -2110,7 +2110,7 @@ mod test {
21102110
let config = hyperactor_config::global::lock();
21112111
let _guard = config.override_key(
21122112
hyperactor::config::REMOTE_ALLOCATOR_HEARTBEAT_INTERVAL,
2113-
Duration::from_secs(60),
2113+
Duration::from_mins(1),
21142114
);
21152115
hyperactor_telemetry::initialize_logging(ClockKind::default());
21162116
let serve_addr = ChannelAddr::any(ChannelTransport::Unix);

hyperactor_mesh/src/v1/host_mesh.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ declare_attrs! {
8888
env_name: Some("HYPERACTOR_MESH_GET_PROC_STATE_MAX_IDLE".to_string()),
8989
py_name: None,
9090
})
91-
pub attr GET_PROC_STATE_MAX_IDLE: Duration = Duration::from_secs(60);
91+
pub attr GET_PROC_STATE_MAX_IDLE: Duration = Duration::from_mins(1);
9292
}
9393

9494
/// A reference to a single host.
@@ -1574,7 +1574,7 @@ mod tests {
15741574
);
15751575
let _guard3 = config.override_key(
15761576
hyperactor::config::MESSAGE_DELIVERY_TIMEOUT,
1577-
Duration::from_secs(60),
1577+
Duration::from_mins(1),
15781578
);
15791579

15801580
let instance = testing::instance().await;
@@ -1614,7 +1614,7 @@ mod tests {
16141614
*actual_attrs
16151615
.get(hyperactor::config::MESSAGE_DELIVERY_TIMEOUT)
16161616
.unwrap(),
1617-
Duration::from_secs(60)
1617+
Duration::from_mins(1)
16181618
);
16191619
}
16201620
}

hyperactor_mesh/src/v1/proc_mesh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ declare_attrs! {
9191
env_name: Some("HYPERACTOR_MESH_GET_ACTOR_STATE_MAX_IDLE".to_string()),
9292
py_name: None,
9393
})
94-
pub attr GET_ACTOR_STATE_MAX_IDLE: Duration = Duration::from_secs(60);
94+
pub attr GET_ACTOR_STATE_MAX_IDLE: Duration = Duration::from_mins(1);
9595
}
9696

9797
/// A reference to a single [`hyperactor::Proc`].

hyperactor_mesh/test/process_allocator_cleanup/process_allocator_cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async fn test_process_allocator_child_cleanup() {
130130
}
131131

132132
eprintln!("Waiting longer to see if children eventually exit due to channel hangup...");
133-
let timeout = Duration::from_secs(60);
133+
let timeout = Duration::from_mins(1);
134134
let start = Instant::now();
135135

136136
loop {

monarch_extension/src/blocking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tokio::time::Duration;
1313
extern "C" fn exit_handler() {
1414
loop {
1515
#[allow(clippy::disallowed_methods)]
16-
std::thread::sleep(Duration::from_secs(60));
16+
std::thread::sleep(Duration::from_mins(1));
1717
}
1818
}
1919

0 commit comments

Comments
 (0)