Skip to content

Commit 83bfc84

Browse files
thomasywangfacebook-github-bot
authored andcommitted
Remove proxy (#474)
Summary: The proxy was a construct previously used to for other processes to communicate with the simulator. Since all simulation is now done in a single process we no longer need this and can delete a nice chunk of code Differential Revision: D77941641
1 parent 2770cc6 commit 83bfc84

File tree

16 files changed

+156
-656
lines changed

16 files changed

+156
-656
lines changed

controller/src/lib.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,20 +1551,13 @@ mod tests {
15511551
#[tokio::test]
15521552
async fn test_sim_supervision_failure() {
15531553
// Start system actor.
1554-
let system_addr = ChannelAddr::any(ChannelTransport::Unix);
1555-
let proxy_addr = ChannelAddr::any(ChannelTransport::Unix);
1556-
simnet::start(
1557-
ChannelAddr::any(ChannelTransport::Unix),
1558-
proxy_addr.clone(),
1559-
1000,
1560-
)
1561-
.unwrap();
1554+
simnet::start();
15621555
simnet::simnet_handle()
15631556
.unwrap()
15641557
.set_training_script_state(simnet::TrainingScriptState::Waiting);
15651558

15661559
let system_sim_addr =
1567-
ChannelAddr::Sim(SimAddr::new(system_addr, proxy_addr.clone()).unwrap());
1560+
ChannelAddr::any(ChannelTransport::Sim(Box::new(ChannelTransport::Unix)));
15681561
// Set very long supervision_update_timeout
15691562
let server_handle = System::serve(
15701563
system_sim_addr.clone(),
@@ -1580,9 +1573,8 @@ mod tests {
15801573
// Bootstrap the controller
15811574
let controller_id = id!(controller[0].root);
15821575
let proc_id = id!(world[0]);
1583-
let controller_proc_listen_addr = ChannelAddr::Sim(
1584-
SimAddr::new(ChannelAddr::any(ChannelTransport::Unix), proxy_addr).unwrap(),
1585-
);
1576+
let controller_proc_listen_addr =
1577+
ChannelAddr::any(ChannelTransport::Sim(Box::new(ChannelTransport::Unix)));
15861578

15871579
let (_, actor_ref) = ControllerActor::bootstrap(
15881580
controller_id.clone(),

hyperactor/src/channel.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ pub enum ChannelTransport {
236236
Local,
237237

238238
/// Sim is a simulated channel for testing.
239-
Sim(/*proxy address:*/ ChannelAddr),
239+
Sim(/*simulated transport:*/ Box<ChannelTransport>),
240240

241241
/// Transport over unix domain socket.
242242
Unix,
@@ -368,7 +368,7 @@ impl ChannelAddr {
368368
Self::MetaTls(hostname, 0)
369369
}
370370
ChannelTransport::Local => Self::Local(0),
371-
ChannelTransport::Sim(proxy) => sim::any(proxy),
371+
ChannelTransport::Sim(transport) => sim::any(*transport),
372372
// This works because the file will be deleted but we know we have a unique file by this point.
373373
ChannelTransport::Unix => Self::Unix(net::unix::SocketAddr::from_str("").unwrap()),
374374
}
@@ -380,7 +380,7 @@ impl ChannelAddr {
380380
Self::Tcp(_) => ChannelTransport::Tcp,
381381
Self::MetaTls(_, _) => ChannelTransport::MetaTls,
382382
Self::Local(_) => ChannelTransport::Local,
383-
Self::Sim(addr) => ChannelTransport::Sim(addr.proxy().clone()),
383+
Self::Sim(addr) => ChannelTransport::Sim(Box::new(addr.transport())),
384384
Self::Unix(_) => ChannelTransport::Unix,
385385
}
386386
}
@@ -637,10 +637,9 @@ mod tests {
637637
}
638638

639639
for (raw, parsed) in cases_ok.iter().zip(src_ok.clone()).map(|(a, _)| {
640-
let proxy_str = "unix!@proxy_a";
641640
(
642-
format!("sim!{},{}", a.0, &proxy_str),
643-
ChannelAddr::Sim(SimAddr::new(a.1.clone(), proxy_str.parse().unwrap()).unwrap()),
641+
format!("sim!{}", a.0),
642+
ChannelAddr::Sim(SimAddr::new(a.1.clone()).unwrap()),
644643
)
645644
}) {
646645
assert_eq!(raw.parse::<ChannelAddr>().unwrap(), parsed);

0 commit comments

Comments
 (0)