Commit 602352ce authored by Neelay Shah's avatar Neelay Shah Committed by GitHub
Browse files

chore: rename dynamo (#44)


Co-authored-by: default avatarBiswa Panda <biswa.panda@gmail.com>
parent ecf53ce2
...@@ -17,7 +17,7 @@ import asyncio ...@@ -17,7 +17,7 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
uvloop.install() uvloop.install()
...@@ -28,7 +28,7 @@ class RequestHandler: ...@@ -28,7 +28,7 @@ class RequestHandler:
yield char yield char
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
component = runtime.namespace("examples/bls").component("foo") component = runtime.namespace("examples/bls").component("foo")
await component.create_service() await component.create_service()
......
...@@ -17,12 +17,12 @@ import asyncio ...@@ -17,12 +17,12 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
await init(runtime, "dynemo") await init(runtime, "dynamo")
async def init(runtime: DistributedRuntime, ns: str): async def init(runtime: DistributedRuntime, ns: str):
......
...@@ -21,7 +21,7 @@ import uvloop ...@@ -21,7 +21,7 @@ import uvloop
from client import init as client_init from client import init as client_init
from server import init as server_init from server import init as server_init
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
def random_string(length=10): def random_string(length=10):
...@@ -29,7 +29,7 @@ def random_string(length=10): ...@@ -29,7 +29,7 @@ def random_string(length=10):
return "".join(random.choices(chars, k=length)) return "".join(random.choices(chars, k=length))
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
ns = random_string() ns = random_string()
task = asyncio.create_task(server_init(runtime, ns)) task = asyncio.create_task(server_init(runtime, ns))
......
...@@ -17,7 +17,7 @@ import asyncio ...@@ -17,7 +17,7 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
class RequestHandler: class RequestHandler:
...@@ -33,9 +33,9 @@ class RequestHandler: ...@@ -33,9 +33,9 @@ class RequestHandler:
yield char yield char
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
await init(runtime, "dynemo") await init(runtime, "dynamo")
async def init(runtime: DistributedRuntime, ns: str): async def init(runtime: DistributedRuntime, ns: str):
......
...@@ -17,12 +17,12 @@ import asyncio ...@@ -17,12 +17,12 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
await init(runtime, "dynemo") await init(runtime, "dynamo")
async def init(runtime: DistributedRuntime, ns: str): async def init(runtime: DistributedRuntime, ns: str):
......
...@@ -21,7 +21,7 @@ import uvloop ...@@ -21,7 +21,7 @@ import uvloop
from client import init as client_init from client import init as client_init
from server import init as server_init from server import init as server_init
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
def random_string(length=10): def random_string(length=10):
...@@ -29,7 +29,7 @@ def random_string(length=10): ...@@ -29,7 +29,7 @@ def random_string(length=10):
return "".join(random.choices(chars, k=length)) return "".join(random.choices(chars, k=length))
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
ns = random_string() ns = random_string()
task = asyncio.create_task(server_init(runtime, ns)) task = asyncio.create_task(server_init(runtime, ns))
......
...@@ -17,7 +17,7 @@ import asyncio ...@@ -17,7 +17,7 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
class RequestHandler: class RequestHandler:
...@@ -31,9 +31,9 @@ class RequestHandler: ...@@ -31,9 +31,9 @@ class RequestHandler:
yield char yield char
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
await init(runtime, "dynemo") await init(runtime, "dynamo")
async def init(runtime: DistributedRuntime, ns: str): async def init(runtime: DistributedRuntime, ns: str):
......
...@@ -17,7 +17,7 @@ import asyncio ...@@ -17,7 +17,7 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
uvloop.install() uvloop.install()
...@@ -29,7 +29,7 @@ class RequestHandler: ...@@ -29,7 +29,7 @@ class RequestHandler:
yield char yield char
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
component = runtime.namespace("examples/pipeline").component("backend") component = runtime.namespace("examples/pipeline").component("backend")
await component.create_service() await component.create_service()
......
...@@ -17,7 +17,7 @@ import asyncio ...@@ -17,7 +17,7 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
uvloop.install() uvloop.install()
...@@ -32,7 +32,7 @@ class RequestHandler: ...@@ -32,7 +32,7 @@ class RequestHandler:
yield output.get("data") yield output.get("data")
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
# client to the next component - in this case the middle component # client to the next component - in this case the middle component
next = ( next = (
......
...@@ -17,7 +17,7 @@ import asyncio ...@@ -17,7 +17,7 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
uvloop.install() uvloop.install()
...@@ -32,7 +32,7 @@ class RequestHandler: ...@@ -32,7 +32,7 @@ class RequestHandler:
yield output.get("data") yield output.get("data")
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
# client to backend # client to backend
backend = ( backend = (
......
...@@ -17,12 +17,12 @@ import asyncio ...@@ -17,12 +17,12 @@ import asyncio
import uvloop import uvloop
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
uvloop.install() uvloop.install()
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
""" """
# Pipeline Example # Pipeline Example
......
...@@ -17,16 +17,16 @@ import asyncio ...@@ -17,16 +17,16 @@ import asyncio
from protocol import Request from protocol import Request
from dynemo.runtime import DistributedRuntime, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_worker
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
""" """
Instantiate a `backend` client and call the `generate` endpoint Instantiate a `backend` client and call the `generate` endpoint
""" """
# get endpoint # get endpoint
endpoint = runtime.namespace("dynemo").component("backend").endpoint("generate") endpoint = runtime.namespace("dynamo").component("backend").endpoint("generate")
# create client # create client
client = await endpoint.client() client = await endpoint.client()
......
...@@ -19,7 +19,7 @@ import asyncio ...@@ -19,7 +19,7 @@ import asyncio
import uvloop import uvloop
from protocol import Request, Response from protocol import Request, Response
from dynemo.runtime import DistributedRuntime, dynemo_endpoint, dynemo_worker from dynamo.runtime import DistributedRuntime, dynamo_endpoint, dynamo_worker
uvloop.install() uvloop.install()
...@@ -29,19 +29,19 @@ class RequestHandler: ...@@ -29,19 +29,19 @@ class RequestHandler:
Request handler for the generate endpoint Request handler for the generate endpoint
""" """
@dynemo_endpoint(Request, Response) @dynamo_endpoint(Request, Response)
async def generate(self, request): async def generate(self, request):
for char in request.data: for char in request.data:
yield char yield char
@dynemo_worker() @dynamo_worker()
async def worker(runtime: DistributedRuntime): async def worker(runtime: DistributedRuntime):
""" """
Instantiate a `backend` component and serve the `generate` endpoint Instantiate a `backend` component and serve the `generate` endpoint
A `Component` can serve multiple endpoints A `Component` can serve multiple endpoints
""" """
component = runtime.namespace("dynemo").component("backend") component = runtime.namespace("dynamo").component("backend")
await component.create_service() await component.create_service()
endpoint = component.endpoint("generate") endpoint = component.endpoint("generate")
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
use std::sync::Arc; use std::sync::Arc;
use dynemo_llm::engines::python::PythonServerStreamingEngine; use dynamo_llm::engines::python::PythonServerStreamingEngine;
use dynemo_runtime::CancellationToken; use dynamo_runtime::CancellationToken;
pub use dynemo_runtime::{ pub use dynamo_runtime::{
pipeline::{async_trait, AsyncEngine, Data, ManyOut, SingleIn}, pipeline::{async_trait, AsyncEngine, Data, ManyOut, SingleIn},
protocols::annotated::Annotated, protocols::annotated::Annotated,
Error, Result, Error, Result,
......
...@@ -25,14 +25,14 @@ use std::{fmt::Display, sync::Arc}; ...@@ -25,14 +25,14 @@ use std::{fmt::Display, sync::Arc};
use tokio::sync::Mutex; use tokio::sync::Mutex;
use tracing_subscriber::FmtSubscriber; use tracing_subscriber::FmtSubscriber;
use dynemo_runtime::{ use dynamo_runtime::{
self as rs, self as rs,
pipeline::{EngineStream, ManyOut, SingleIn}, pipeline::{EngineStream, ManyOut, SingleIn},
protocols::annotated::Annotated as RsAnnotated, protocols::annotated::Annotated as RsAnnotated,
traits::DistributedRuntimeProvider, traits::DistributedRuntimeProvider,
}; };
use dynemo_llm::{self as llm_rs}; use dynamo_llm::{self as llm_rs};
mod engine; mod engine;
mod llm; mod llm;
......
...@@ -19,7 +19,7 @@ use crate::llm::model_card::ModelDeploymentCard; ...@@ -19,7 +19,7 @@ use crate::llm::model_card::ModelDeploymentCard;
use llm_rs::protocols::common::llm_backend::{BackendInput, BackendOutput}; use llm_rs::protocols::common::llm_backend::{BackendInput, BackendOutput};
use llm_rs::types::Annotated; use llm_rs::types::Annotated;
use dynemo_runtime::pipeline::{Operator, ServiceBackend, ServiceFrontend, Source}; use dynamo_runtime::pipeline::{Operator, ServiceBackend, ServiceFrontend, Source};
use crate::engine::PythonAsyncEngine; use crate::engine::PythonAsyncEngine;
......
...@@ -27,9 +27,9 @@ use llm_rs::{ ...@@ -27,9 +27,9 @@ use llm_rs::{
}, },
}; };
use dynemo_runtime::pipeline::{Operator, ServiceFrontend, Source}; use dynamo_runtime::pipeline::{Operator, ServiceFrontend, Source};
use dynemo_runtime::pipeline::{ManyOut, SegmentSink, SingleIn}; use dynamo_runtime::pipeline::{ManyOut, SegmentSink, SingleIn};
#[pyclass] #[pyclass]
pub(crate) struct OAIChatPreprocessor { pub(crate) struct OAIChatPreprocessor {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from dynemo._core import KvIndexer as KvIndexer from dynamo._core import KvIndexer as KvIndexer
from dynemo._core import KvMetricsAggregator as KvMetricsAggregator from dynamo._core import KvMetricsAggregator as KvMetricsAggregator
from dynemo._core import KvMetricsPublisher as KvMetricsPublisher from dynamo._core import KvMetricsPublisher as KvMetricsPublisher
from dynemo._core import KvRouter as KvRouter from dynamo._core import KvRouter as KvRouter
...@@ -22,15 +22,15 @@ from pydantic import BaseModel, ValidationError ...@@ -22,15 +22,15 @@ from pydantic import BaseModel, ValidationError
# List all the classes in the _core module for re-export # List all the classes in the _core module for re-export
# import * causes "unable to detect undefined names" # import * causes "unable to detect undefined names"
from dynemo._core import Backend as Backend from dynamo._core import Backend as Backend
from dynemo._core import Client as Client from dynamo._core import Client as Client
from dynemo._core import DistributedRuntime as DistributedRuntime from dynamo._core import DistributedRuntime as DistributedRuntime
from dynemo._core import KvRouter as KvRouter from dynamo._core import KvRouter as KvRouter
from dynemo._core import ModelDeploymentCard as ModelDeploymentCard from dynamo._core import ModelDeploymentCard as ModelDeploymentCard
from dynemo._core import OAIChatPreprocessor as OAIChatPreprocessor from dynamo._core import OAIChatPreprocessor as OAIChatPreprocessor
def dynemo_worker(): def dynamo_worker():
def decorator(func): def decorator(func):
@wraps(func) @wraps(func)
async def wrapper(*args, **kwargs): async def wrapper(*args, **kwargs):
...@@ -59,7 +59,7 @@ def dynemo_worker(): ...@@ -59,7 +59,7 @@ def dynemo_worker():
return decorator return decorator
def dynemo_endpoint( def dynamo_endpoint(
request_model: Union[Type[BaseModel], Type[Any]], response_model: Type[BaseModel] request_model: Union[Type[BaseModel], Type[Any]], response_model: Type[BaseModel]
) -> Callable: ) -> Callable:
def decorator( def decorator(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment