Skip to content

Commit

Permalink
feat(hydro_deploy): split Rust core from Python bindings (#986)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadaj authored Dec 20, 2023
1 parent 174607d commit c50ca12
Show file tree
Hide file tree
Showing 76 changed files with 112 additions and 165 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:

- name: Build CLI
run: |
cd hydro_cli
cd hydro_deploy/hydro_cli
python -m venv .venv
source .venv/bin/activate
pip install maturin
Expand All @@ -219,7 +219,7 @@ jobs:
- name: Run Python tests
run: |
ulimit -c unlimited
cd hydro_cli
cd hydro_deploy/hydro_cli
source .venv/bin/activate
cd python_tests
pip install -r requirements.txt
Expand Down
64 changes: 32 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

members = [
"benches",
"hydro_cli",
"hydro_cli_examples",
"hydro_deploy/hydro_cli",
"hydro_deploy/hydro_cli_examples",
"hydro_deploy/hydroflow_cli_integration",
"hydro_deploy/hydroflow_plus_cli_integration",
"hydroflow",
"hydroflow_cli_integration",
"hydroflow_datalog",
"hydroflow_datalog_core",
"hydroflow_lang",
"hydroflow_macro",
"hydroflow_plus",
"hydroflow_plus_cli_integration",
"hydroflow_plus_test",
"hydroflow_plus_test_macro",
"lattices",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/hydroflow_plus/distributed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async fn main() {
Finally, we need to deploy our dataflow with the appropriate network topology. We achieve this by using [Hydro Deploy](../deploy/index.md). Hydroflow+ integrates with Hydro Deploy to automatically construct the topology based on the flow graph. We can create a new file `examples/first_ten_distributed.rs` with the following contents:

```rust
use hydro_cli::core::Deployment;
use hydro_deploy::Deployment;
use hydroflow_plus_cli_integration::CLIDeployNodeBuilder;

#[tokio::main]
Expand Down
66 changes: 0 additions & 66 deletions hydro_cli/echo.hydro.py

This file was deleted.

File renamed without changes.
18 changes: 3 additions & 15 deletions hydro_cli/Cargo.toml → hydro_deploy/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
[package]
name = "hydro_cli"
name = "hydro_deploy"
publish = true
version = "0.5.0"
edition = "2021"
license = "Apache-2.0"
documentation = "https://docs.rs/hydro_cli/"
description = "Hydro Deploy Command Line Interface"

[lib]
name = "hydro_cli"
# "cdylib" is necessary to produce a shared library for Python to import from.
crate-type = ["lib", "cdylib"]
documentation = "https://docs.rs/hydro_deploy/"
description = "Hydro Deploy"

[dependencies]
tokio = { version = "1.16", features = [ "full" ] }
tokio-util = { version = "0.7.7", features=[ "compat" ] }
once_cell = "1.17"
anyhow = { version = "1.0.69", features = [ "backtrace" ] }
clap = { version = "4.1.8", features = ["derive"] }
pyo3 = { version = "0.18", features = ["abi3-py37"] }
pyo3-asyncio = { version = "0.18", features = ["attributes", "tokio-runtime"] }
pythonize = "0.18"
async-trait = "0.1.64"
async-process = "1.6.0"
async-recursion = "1"
Expand All @@ -35,11 +26,8 @@ shell-escape = "0.1.5"
dyn-clone = "1"
bytes = "1.1.0"
nanoid = "0.4.0"
ctrlc = "3.2.5"
nix = "0.26.2"
hydroflow_cli_integration = { path = "../hydroflow_cli_integration", version = "^0.3.0" }
indicatif = "0.17.6"
cargo_metadata = "0.15.4"
async-once-cell = "0.5.3"

[dev-dependencies]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Deployment {
user: Option<String>,
) -> Arc<RwLock<GCPComputeEngineHost>> {
self.add_host(|id| {
crate::core::GCPComputeEngineHost::new(
super::GCPComputeEngineHost::new(
id,
project,
machine_type,
Expand Down Expand Up @@ -77,7 +77,7 @@ impl Deployment {
external_ports: Vec<u16>,
) -> Arc<RwLock<HydroflowCrate>> {
self.add_service(|id| {
crate::core::HydroflowCrate::new(
super::HydroflowCrate::new(
id,
src.into(),
on,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use nanoid::nanoid;
use once_cell::sync::Lazy;
use tokio::sync::OnceCell;

use crate::core::progress::ProgressTracker;
use crate::core::HostTargetType;
use crate::progress::ProgressTracker;
use crate::HostTargetType;

#[derive(PartialEq, Eq, Hash)]
struct CacheKey {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use anyhow::{anyhow, bail, Result};
use async_channel::Receiver;
use async_trait::async_trait;
use futures_core::Future;
use hydroflow_cli_integration::{ServerBindConfig, ServerPort};
use hydroflow_cli_integration::{InitConfig, ServerPort};
use tokio::sync::RwLock;

use self::ports::{HydroflowPortConfig, HydroflowSink, SourcePath};
Expand Down Expand Up @@ -205,8 +205,6 @@ impl HydroflowCrate {
}
}

type InitConfig = (HashMap<String, ServerBindConfig>, Option<String>);

#[async_trait]
impl Service for HydroflowCrate {
fn collect_resources(&mut self, _resource_batch: &mut ResourceBatch) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use hydroflow_cli_integration::ServerPort;
use tokio::sync::RwLock;

use super::HydroflowCrate;
use crate::core::{ClientStrategy, Host, HostStrategyGetter, LaunchedHost, ServerStrategy};
use crate::{ClientStrategy, Host, HostStrategyGetter, LaunchedHost, ServerStrategy};

pub trait HydroflowSource: Send + Sync {
fn source_path(&self) -> SourcePath;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hydro_cli/src/core/ssh.rs → hydro_deploy/core/src/ssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use tokio::sync::RwLock;

use super::localhost::create_broadcast;
use super::progress::ProgressTracker;
use super::util::async_retry;
use super::{LaunchedBinary, LaunchedHost, ResourceResult, ServerStrategy};
use crate::core::util::async_retry;

struct LaunchedSSHBinary {
_resource_result: Arc<ResourceResult>,
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions hydro_deploy/hydro_cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.venv/
.hydro/
*.csv
File renamed without changes.
27 changes: 27 additions & 0 deletions hydro_deploy/hydro_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "hydro_cli"
publish = true
version = "0.5.0"
edition = "2021"
license = "Apache-2.0"
documentation = "https://docs.rs/hydro_cli/"
description = "Hydro Deploy Command Line Interface"

[lib]
name = "hydro_cli"
# "cdylib" is necessary to produce a shared library for Python to import from.
crate-type = ["cdylib"]

[dependencies]
hydro_deploy = { path = "../core", version = "^0.5.0" }
tokio = { version = "1.16", features = [ "full" ] }
once_cell = "1.17"
anyhow = { version = "1.0.69", features = [ "backtrace" ] }
clap = { version = "4.1.8", features = ["derive"] }
pyo3 = { version = "0.18", features = ["abi3-py37"] }
pyo3-asyncio = { version = "0.18", features = ["attributes", "tokio-runtime"] }
pythonize = "0.18"
futures = "0.3.26"
async-channel = "1.8.0"
bytes = "1.1.0"
hydroflow_cli_integration = { path = "../hydroflow_cli_integration", version = "^0.3.0" }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion hydro_cli/src/lib.rs → hydro_deploy/hydro_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use tokio::sync::RwLock;
use crate::core::hydroflow_crate::ports::HydroflowSource;

mod cli;
pub mod core;
use hydro_deploy as core;

static TOKIO_RUNTIME: std::sync::RwLock<Option<tokio::runtime::Runtime>> =
std::sync::RwLock::new(None);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ name = "dedalus_2pc_participant"
name = "ws_chat_server"

[dev-dependencies]
hydroflow = { path = "../hydroflow", features = [ "cli_integration" ] }
hydroflow_datalog = { path = "../hydroflow_datalog" }
hydroflow = { path = "../../hydroflow", features = [ "cli_integration" ] }
hydroflow_datalog = { path = "../../hydroflow_datalog" }

tokio = { version = "1.16", features = [ "full" ] }
serde = { version = "1", features = ["rc"] }
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit c50ca12

Please sign in to comment.