Skip to main content

apalis_workflow/dag/
response.rs

1use std::collections::HashMap;
2
3use apalis_core::task::task_id::TaskId;
4use petgraph::graph::NodeIndex;
5use serde::{Deserialize, Serialize};
6
7/// Response from DAG execution step
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
9pub enum DagExecutionResponse<Compact, IdType> {
10    /// Entry nodes have been fanned out
11    EntryFanOut {
12        /// Map of node indices to their task IDs
13        node_task_ids: HashMap<NodeIndex, TaskId<IdType>>,
14    },
15    /// Next tasks have been fanned out
16    FanOut {
17        /// Result of the current task
18        response: Compact,
19        /// Map of node indices to their task IDs
20        node_task_ids: HashMap<NodeIndex, TaskId<IdType>>,
21    },
22    /// Next task has been enqueued
23    EnqueuedNext {
24        /// Result of the current task
25        result: Compact,
26    },
27    /// Waiting for dependencies to complete
28    WaitingForDependencies {
29        /// Map of pending dependency node indices to their task IDs
30        pending_dependencies: HashMap<NodeIndex, TaskId<IdType>>,
31    },
32
33    /// DAG execution is complete
34    Complete {
35        /// Result of the final task
36        result: Compact,
37    },
38}