-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge d16e9f2 into sapling-pr-archive-shadaj
- Loading branch information
Showing
31 changed files
with
203 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use hydroflow_plus_test::*; | ||
|
||
// cannot use hydroflow::main because connect_local_blocking causes a deadlock | ||
#[tokio::main] | ||
async fn main() { | ||
let node_id: usize = std::env::args().nth(1).unwrap().parse().unwrap(); | ||
let ports = hydroflow::util::cli::init().await; | ||
|
||
let joined = hydroflow_plus_test::networked::networked_basic!(&ports, node_id); | ||
|
||
hydroflow::util::cli::launch_flow(joined).await; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from codecs import decode | ||
import json | ||
from pathlib import Path | ||
import pytest | ||
import hydro | ||
|
||
@pytest.mark.asyncio | ||
async def test_networked_basic(): | ||
deployment = hydro.Deployment() | ||
localhost_machine = deployment.Localhost() | ||
|
||
sender = deployment.CustomService( | ||
external_ports=[], | ||
on=localhost_machine.client_only(), | ||
) | ||
|
||
program_zero = deployment.HydroflowCrate( | ||
src=str((Path(__file__).parent.parent).absolute()), | ||
args=["0"], | ||
example="networked_basic", | ||
profile="dev", | ||
on=localhost_machine | ||
) | ||
|
||
program_one = deployment.HydroflowCrate( | ||
src=str((Path(__file__).parent.parent).absolute()), | ||
args=["1"], | ||
example="networked_basic", | ||
profile="dev", | ||
on=localhost_machine | ||
) | ||
|
||
sender_port = sender.client_port() | ||
sender_port.send_to(program_zero.ports.node_zero_input) | ||
|
||
program_zero.ports.node_zero_output.send_to(program_one.ports.node_one_input) | ||
|
||
await deployment.deploy() | ||
|
||
receiver_out = await program_one.stdout() | ||
connection = await (await sender_port.server_port()).into_sink() | ||
|
||
await deployment.start() | ||
await connection.send(bytes("hi!", "utf-8")) | ||
|
||
async for log in receiver_out: | ||
assert log == "node one received: \"hi!\"" | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pytest | ||
pytest-asyncio |
Oops, something went wrong.