Skip to content

Commit

Permalink
refactor(hydroflow_plus_test): reorganize examples, one per file, add…
Browse files Browse the repository at this point in the history
… local `compute_pi` example (#1333)

fix #1306
  • Loading branch information
MingweiSamuel authored Jul 10, 2024
1 parent 67c0e51 commit bedbb3f
Show file tree
Hide file tree
Showing 76 changed files with 1,106 additions and 1,074 deletions.
2 changes: 1 addition & 1 deletion hydroflow_plus_test/examples/compute_pi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main() {
};

let builder = hydroflow_plus::FlowBuilder::new();
hydroflow_plus_test::cluster::compute_pi(
hydroflow_plus_test::cluster::compute_pi::compute_pi(
&builder,
&DeployProcessSpec::new(|| {
let mut deployment = deployment.borrow_mut();
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/examples/first_ten_distributed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async fn main() {
};

let builder = hydroflow_plus::FlowBuilder::new();
hydroflow_plus_test::first_ten::first_ten_distributed(
hydroflow_plus_test::distributed::first_ten::first_ten_distributed(
&builder,
&DeployProcessSpec::new(|| {
let host = create_host(&mut deployment);
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/examples/map_reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn main() {
};

let builder = hydroflow_plus::FlowBuilder::new();
hydroflow_plus_test::cluster::map_reduce(
hydroflow_plus_test::cluster::map_reduce::map_reduce(
&builder,
&DeployProcessSpec::new(|| {
let mut deployment = deployment.borrow_mut();
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/examples/networked_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async fn main() {

let deployment = RefCell::new(deployment);
let builder = hydroflow_plus::FlowBuilder::new();
let io = hydroflow_plus_test::networked::networked_basic(
let io = hydroflow_plus_test::distributed::networked::networked_basic(
&builder,
&DeployProcessSpec::new(|| {
deployment.borrow_mut().add_service(
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/examples/perf_compute_pi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main() {
};

let builder = hydroflow_plus::FlowBuilder::new();
hydroflow_plus_test::cluster::compute_pi(
hydroflow_plus_test::cluster::compute_pi::compute_pi(
&builder,
&DeployProcessSpec::new(|| {
let mut deployment = deployment.borrow_mut();
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/examples/simple_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn main() {
};

let builder = hydroflow_plus::FlowBuilder::new();
hydroflow_plus_test::cluster::simple_cluster(
hydroflow_plus_test::cluster::simple_cluster::simple_cluster(
&builder,
&DeployProcessSpec::new(|| {
let mut deployment = deployment.borrow_mut();
Expand Down
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/bin/cardinality_compute_pi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async fn main() {
});

hydroflow_plus::launch!(
|ports| hydroflow_plus_test::cluster::cardinality_compute_pi_runtime!(
|ports| hydroflow_plus_test::cluster::compute_pi::cardinality_compute_pi_runtime!(
ports,
&batch_size,
&counters,
Expand Down
7 changes: 3 additions & 4 deletions hydroflow_plus_test/src/bin/compute_pi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
async fn main() {
let batch_size = 8192;

hydroflow_plus::launch!(|ports| hydroflow_plus_test::cluster::compute_pi_runtime!(
ports,
&batch_size,
))
hydroflow_plus::launch!(
|ports| hydroflow_plus_test::cluster::compute_pi::compute_pi_runtime!(ports, &batch_size,)
)
.await;
}
17 changes: 17 additions & 0 deletions hydroflow_plus_test/src/bin/compute_pi_local.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use std::time::Duration;

use tokio::time::timeout;

// cannot use hydroflow::main because connect_local_blocking causes a deadlock
#[tokio::main]
async fn main() {
let batch_size = 8192;
let mut flow = hydroflow_plus_test::local::compute_pi::compute_pi_runtime!(&batch_size);
flow.meta_graph()
.unwrap()
.open_mermaid(&Default::default())
.unwrap();
timeout(Duration::from_secs(10), flow.run_async())
.await
.expect_err("Expected timeout");
}
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/bin/first_ten_distributed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[tokio::main]
async fn main() {
hydroflow_plus::util::cli::launch!(|ports| {
hydroflow_plus_test::first_ten::first_ten_distributed_runtime!(ports)
hydroflow_plus_test::distributed::first_ten::first_ten_distributed_runtime!(ports)
})
.await;
}
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/bin/many_to_many.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[tokio::main]
async fn main() {
hydroflow_plus::util::cli::launch!(|ports| {
hydroflow_plus_test::cluster::many_to_many_runtime!(ports)
hydroflow_plus_test::cluster::many_to_many::many_to_many_runtime!(ports)
})
.await;
}
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/bin/map_reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[tokio::main]
async fn main() {
hydroflow_plus::util::cli::launch!(|ports| {
hydroflow_plus_test::cluster::map_reduce_runtime!(ports)
hydroflow_plus_test::cluster::map_reduce::map_reduce_runtime!(ports)
})
.await;
}
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/bin/networked_basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[tokio::main]
async fn main() {
hydroflow_plus::util::cli::launch!(|ports| {
hydroflow_plus_test::networked::networked_basic_runtime!(ports)
hydroflow_plus_test::distributed::networked::networked_basic_runtime!(ports)
})
.await;
}
2 changes: 1 addition & 1 deletion hydroflow_plus_test/src/bin/simple_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#[tokio::main]
async fn main() {
hydroflow_plus::util::cli::launch!(|ports| {
hydroflow_plus_test::cluster::simple_cluster_runtime!(ports)
hydroflow_plus_test::cluster::simple_cluster::simple_cluster_runtime!(ports)
})
.await;
}
Loading

0 comments on commit bedbb3f

Please sign in to comment.