[router] Impl radix tree and set up CI (#1893)

Co-authored-by: Lianmin Zheng <lianminzheng@gmail.com>
This commit is contained in:
Byron Hsu
2024-11-04 10:56:52 -08:00
committed by GitHub
parent 3cd2809277
commit 530ff541cf
11 changed files with 458 additions and 72 deletions

View File

@@ -1,6 +1,7 @@
use pyo3::prelude::*;
mod server;
pub mod router;
mod server;
pub mod tree;
// Python binding
#[pyclass]
@@ -8,7 +9,7 @@ struct Router {
host: String,
port: u16,
worker_urls: Vec<String>,
policy: String
policy: String,
}
#[pymethods]
@@ -19,7 +20,7 @@ impl Router {
host,
port,
worker_urls,
policy
policy,
}
}
@@ -30,7 +31,9 @@ impl Router {
let policy = self.policy.clone();
actix_web::rt::System::new().block_on(async move {
server::startup(host, port, worker_urls, policy).await.unwrap();
server::startup(host, port, worker_urls, policy)
.await
.unwrap();
});
Ok(())
@@ -42,4 +45,4 @@ impl Router {
fn sglang_router(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::<Router>()?;
Ok(())
}
}