Skip to content

Commit 0abd136

Browse files
committed
export errors
1 parent 36acf22 commit 0abd136

File tree

6 files changed

+9
-147
lines changed

6 files changed

+9
-147
lines changed

compute/src/reqres/task.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ impl TaskResponder {
7070

7171
// check if the model is available in this node, if so
7272
// it will return an executor that can run this model
73-
let executor = node
74-
.config
75-
.executors
76-
.get_executor(&task_body.model)
77-
.await
78-
.wrap_err("could not get an executor")?;
73+
let executor = node.config.executors.get_executor(&task_body.model).await?;
7974

8075
let task_metadata = TaskWorkerMetadata {
8176
task_id: task.task_id,

executor/src/executors/errors.rs

Lines changed: 0 additions & 129 deletions
This file was deleted.

executor/src/executors/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ use crate::ModelProvider;
22
use rig::completion::PromptError;
33
use std::collections::HashSet;
44

5-
mod errors;
6-
pub use errors::DriaExecutorError;
7-
85
mod ollama;
96
use ollama::OllamaClient;
107

executor/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod executors;
2-
pub use executors::{DriaExecutor, DriaExecutorError};
2+
pub use executors::DriaExecutor;
33

44
mod manager;
55
pub use manager::DriaExecutorsManager;
@@ -11,7 +11,7 @@ mod task;
1111
pub use task::{TaskBody, TaskResult};
1212

1313
pub use rig::completion::CompletionModel;
14-
pub use rig::completion::PromptError;
14+
pub use rig::completion::{CompletionError, PromptError};
1515

1616
// re-export ollama_rs
1717
pub use ollama_rs;

executor/src/manager.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
use crate::{executors::DriaExecutor, Model, ModelProvider};
12
use std::collections::{HashMap, HashSet};
23

3-
use crate::{executors::DriaExecutor, DriaExecutorError, Model, ModelProvider};
4-
54
#[derive(Clone)]
65
pub struct DriaExecutorsManager {
76
/// List of all models supported by this node.
@@ -53,17 +52,17 @@ impl DriaExecutorsManager {
5352
///
5453
/// If the model's provider is not supported, an error is returned.
5554
/// Likewise, if the provider is supported but the model is not, an error is returned.
56-
pub async fn get_executor(&self, model: &Model) -> Result<DriaExecutor, DriaExecutorError> {
55+
pub async fn get_executor(&self, model: &Model) -> eyre::Result<DriaExecutor> {
5756
let provider = model.provider();
5857
let (executor, models) = self
5958
.providers
60-
.get(&model.provider())
61-
.ok_or(DriaExecutorError::ProviderNotSupported(provider))?;
59+
.get(&provider)
60+
.ok_or_else(|| eyre::eyre!("Provider {provider} supported by this executor"))?;
6261

6362
if models.contains(model) {
6463
Ok(executor.clone())
6564
} else {
66-
Err(DriaExecutorError::ModelNotSupported(*model))
65+
Err(eyre::eyre!("Model {model} not supported by this executor"))
6766
}
6867
}
6968

p2p/src/behaviour.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl DriaBehaviour {
2424

2525
/// Configures the request-response behaviour for the node.
2626
///
27-
/// The protocol supports bytes only,
27+
/// The protocol supports bytes only.
2828
#[inline]
2929
fn create_request_response_behaviour(
3030
protocol_name: StreamProtocol,

0 commit comments

Comments
 (0)