1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use wakflo_common::{JobProcessStatus, SystemActivityLog};

#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug, Default)]
pub struct JobInstanceState {
    /// Task that owns this schema instance
    pub previous_task_id: Option<String>,

    /// Task that owns this schema instance
    pub current_task_id: Option<String>,

    /// Task that owns this schema instance
    pub next_task_id: Option<String>,

    pub steps: HashMap<String, TaskStepState>,

    pub input: HashMap<String, serde_json::Value>,

    pub output: HashMap<String, serde_json::Value>,
}

#[derive(PartialEq, Eq, Serialize, Deserialize, Clone, Debug, Default)]
pub struct TaskStepState {
    pub task_id: String,

    pub input: HashMap<String, serde_json::Value>,

    pub output: HashMap<String, serde_json::Value>,

    pub errors: Vec<SystemActivityLog>,

    pub status: JobProcessStatus,
}

/// # TaskRunResult
///
/// Result for each schema processed
#[derive(Serialize, PartialEq, Eq, Deserialize, Clone, Debug, Default)]
pub struct TaskRunResult {
    /// Error while executing schema
    pub task_execution_error: Option<String>,

    /// STD output from terminal
    pub stdout: Option<String>,

    /// STD error from terminal
    pub stderr: Option<String>,

    /// Return code used for understanding of there was an error,
    pub return_code: i32,
}