fix: change where TaskHandle is borrowed to prevent repeat output fetches
This commit is contained in:
1 parent
c8efb00175
commit
9fbe4c2fd8
47 files changed
+323
-513
No files matched your search
@@ -6,42 +6,13 @@
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[non_exhaustive]
|
||||
pub enum DagError {
|
||||
/// Invalid dependency: task does not exist
|
||||
InvalidDependency { task_id: u32 },
|
||||
/// Type mismatch in task dependencies
|
||||
TypeMismatch {
|
||||
expected: &'static str,
|
||||
found: &'static str,
|
||||
},
|
||||
/// Task panicked during execution
|
||||
TaskPanicked { task_id: u32, panic_message: String },
|
||||
/// Result not found for task
|
||||
ResultNotFound { task_id: u32 },
|
||||
}
|
||||
|
||||
impl std::fmt::Display for DagError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
DagError::InvalidDependency { task_id } => {
|
||||
write!(
|
||||
f,
|
||||
"Invalid dependency: task #{} does not exist.\n\
|
||||
\n\
|
||||
Ensure all task handles reference tasks that have been added to the DAG.",
|
||||
task_id
|
||||
)
|
||||
}
|
||||
DagError::TypeMismatch { expected, found } => {
|
||||
write!(
|
||||
f,
|
||||
"Type mismatch in task dependencies.\n\
|
||||
Expected: {}\n\
|
||||
Found: {}\n\
|
||||
\n\
|
||||
Verify that dependency types match the task's Input type exactly.",
|
||||
expected, found
|
||||
)
|
||||
}
|
||||
DagError::TaskPanicked {
|
||||
task_id,
|
||||
panic_message,
|
||||
@@ -54,15 +25,6 @@ impl std::fmt::Display for DagError {
|
||||
task_id, panic_message
|
||||
)
|
||||
}
|
||||
DagError::ResultNotFound { task_id } => {
|
||||
write!(
|
||||
f,
|
||||
"Result not found for task #{}.\n\
|
||||
\n\
|
||||
Call dag.run(|fut| async move {{ tokio::spawn(fut).await.unwrap() }}).",
|
||||
task_id
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user