Skip to content

Commit a1dfaf8

Browse files
thomasywangfacebook-github-bot
authored andcommitted
Remove proxy (#474)
Summary: Pull Request resolved: #474 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 90e9195 commit a1dfaf8

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
@@ -1559,20 +1559,13 @@ mod tests {
15591559
#[tokio::test]
15601560
async fn test_sim_supervision_failure() {
15611561
// Start system actor.
1562-
let system_addr = ChannelAddr::any(ChannelTransport::Unix);
1563-
let proxy_addr = ChannelAddr::any(ChannelTransport::Unix);
1564-
simnet::start(
1565-
ChannelAddr::any(ChannelTransport::Unix),
1566-
proxy_addr.clone(),
1567-
1000,
1568-
)
1569-
.unwrap();
1562+
simnet::start();
15701563
simnet::simnet_handle()
15711564
.unwrap()
15721565
.set_training_script_state(simnet::TrainingScriptState::Waiting);
15731566

15741567
let system_sim_addr =
1575-
ChannelAddr::Sim(SimAddr::new(system_addr, proxy_addr.clone()).unwrap());
1568+
ChannelAddr::any(ChannelTransport::Sim(Box::new(ChannelTransport::Unix)));
15761569
// Set very long supervision_update_timeout
15771570
let server_handle = System::serve(
15781571
system_sim_addr.clone(),
@@ -1588,9 +1581,8 @@ mod tests {
15881581
// Bootstrap the controller
15891582
let controller_id = id!(controller[0].root);
15901583
let proc_id = id!(world[0]);
1591-
let controller_proc_listen_addr = ChannelAddr::Sim(
1592-
SimAddr::new(ChannelAddr::any(ChannelTransport::Unix), proxy_addr).unwrap(),
1593-
);
1584+
let controller_proc_listen_addr =
1585+
ChannelAddr::any(ChannelTransport::Sim(Box::new(ChannelTransport::Unix)));
15941586

15951587
let (_, actor_ref) = ControllerActor::bootstrap(
15961588
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)