Skip to content

Commit

Permalink
Fixing docker-compose example (#166)
Browse files Browse the repository at this point in the history
* Fixing docker-compose example

* Removing some TODOs

* Do not hold guard across long running input -> embedding conversion
  • Loading branch information
deven96 authored Dec 4, 2024
1 parent a727297 commit 1e0489c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
34 changes: 14 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,34 +109,28 @@ Below is an example `docker-compose.yaml` configuration to run both `ahnlich-db`
services:
ahnlich_db:
image: ghcr.io/deven96/ahnlich-db:latest
command: "ahnlich-db run --host 0.0.0.0 --enable-tracing"
command: "ahnlich-db run --host 0.0.0.0 --enable-tracing --otel-endpoint http://jaeger:4317'"
ports:
- "1369:1369"

ahnlich_ai:
image: ghcr.io/deven96/ahnlich-ai:latest
command: "ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 --port 8880 --enable-tracing --supported-models all-minilm-l6-v2,resnet-50"
command: "ahnlich-ai run --db-host ahnlich_db --host 0.0.0.0 -supported-models all-minilm-l6-v2,resnet-50 --enable-tracing ---otel-endpoint http://jaeger:4317'"
ports:
- "1370:1370"
```
---
#### Environment Variables
The following environment variable can also be set:
- `DEMO_OTEL_URL`: Set the OpenTelemetry endpoint. Example:

```bash
DEMO_OTEL_URL=http://<otel-endpoint>
```

You can pass this variable directly to your Docker containers using `environment` in your Docker Compose file or when running `docker run`.

---


# optional jaeger service whenever --enable-tracing and
# --otel-endpoint is used
jaeger:
image: jaegertracing/all-in-one:${JAEGER_VERSION:-latest}
ports:
- "16686:16686"
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "4317:4317" # otlp grpc
- "4318:4318" # otlp http
```
### Contributing
Expand Down
11 changes: 5 additions & 6 deletions ahnlich/ai/src/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use tracing_opentelemetry::OpenTelemetrySpanExt;
type ModelThreadResponse = Result<Vec<StoreKey>, AIProxyError>;

struct ModelThreadRequest {
// TODO: change this to a Vec of preprocessed input enum
inputs: Vec<StoreInput>,
response: oneshot::Sender<ModelThreadResponse>,
preprocess_action: PreprocessAction,
Expand Down Expand Up @@ -198,8 +197,10 @@ impl Task for ModelThread {
}

async fn run(&self) -> TaskState {
if let Some(model_request) = self.request_receiver.lock().await.recv().await {
// TODO actually service model request in here and return
let mut guard = self.request_receiver.lock().await;
let request = guard.recv().await;
drop(guard);
if let Some(model_request) = request {
let ModelThreadRequest {
inputs,
response,
Expand Down Expand Up @@ -233,8 +234,6 @@ impl ModelManager {
model_config: ModelConfig,
task_manager: Arc<TaskManager>,
) -> Result<Self, AIProxyError> {
// TODO: Actually load the model at this point, with supported models and throw up errors,
// also start up the various models with the task manager passed in
let models = Cache::builder()
.max_capacity(model_config.supported_models.len() as u64)
.time_to_idle(Duration::from_secs(model_config.model_idle_time))
Expand All @@ -261,7 +260,7 @@ impl ModelManager {
&self,
model: &SupportedModels,
) -> Result<mpsc::Sender<ModelThreadRequest>, AIProxyError> {
let (request_sender, request_receiver) = mpsc::channel(100);
let (request_sender, request_receiver) = mpsc::channel(10000);
// There may be other things needed to load a model thread
let model_thread =
ModelThread::new(*model, &self.config.model_cache_location, request_receiver)?;
Expand Down
1 change: 0 additions & 1 deletion ahnlich/dsl/src/ai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ pub fn parse_ai_query(input: &str) -> Result<Vec<AIQuery>, DslError> {
key: key.remove(0),
}
}
// TODO: Introduce AIQuery::GetKey & AIQuery::ListClients
Rule::create_non_linear_algorithm_index => {
let (store, non_linear_indices) =
parse_create_non_linear_algorithm_index(statement)?;
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ services:
context: ./ahnlich/
args:
- AHNLICH_BIN=ahnlich-db
environment:
- DEMO_OTEL_URL=http://jaeger:4317
depends_on:
jaeger:
condition: service_started
Expand All @@ -35,8 +33,6 @@ services:
context: ./ahnlich/
args:
- AHNLICH_BIN=ahnlich-ai
environment:
- DEMO_OTEL_URL=http://jaeger:4317
depends_on:
jaeger:
condition: service_started
Expand Down

0 comments on commit 1e0489c

Please sign in to comment.