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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! Error types for the runs runtime.
use thiserror::Error;
use super::model::{BundleId, EdgeId, JobId, PipelineId, RunId};
/// Top-level error from the [`super::store::Store`] trait.
#[derive(Debug, Error)]
pub enum StoreError {
/// Pipeline id already exists with a different spec.
#[error("pipeline already exists with a different spec: {0}")]
PipelineConflict(PipelineId),
/// Pipeline id not found.
#[error("pipeline not found: {0}")]
PipelineNotFound(PipelineId),
/// Run id not found.
#[error("run not found: {0}")]
RunNotFound(RunId),
/// Job id not found.
#[error("job not found: {0}")]
JobNotFound(JobId),
/// Bundle id not found.
#[error("bundle not found: {0}")]
BundleNotFound(BundleId),
/// Edge id not found.
#[error("edge not found: {0}")]
EdgeNotFound(EdgeId),
/// Pipeline spec failed validation.
#[error("pipeline spec invalid: {0}")]
PipelineInvalid(String),
/// Surreal/IO error etc.
#[error("backend error: {0}")]
Backend(String),
/// Invariant the implementation expected to hold did not.
#[error("invariant violated: {0}")]
Invariant(String),
}
/// Pipeline build-time validation errors.
#[derive(Debug, Error, PartialEq, Eq)]
pub enum PipelineValidationError {
/// Pipeline contains a cycle. Lists one cycle for the user.
#[error("pipeline has a cycle through jobs: {0:?}")]
Cycle(Vec<JobId>),
/// Edge references a job that is not in the spec.
#[error("edge {edge_id} references unknown job {job_id}")]
UnknownJob {
/// Offending edge.
edge_id: EdgeId,
/// Job that is missing.
job_id: JobId,
},
/// Two edges write the same `(to, target)` and at least one declares
/// `MergePolicy::Reject`, or they disagree on the policy.
#[error("conflicting edges into job {to} field {target:?}: {detail}")]
EdgeConflict {
/// Target job.
to: JobId,
/// Target field name.
target: String,
/// Human-readable detail.
detail: String,
},
/// A bundle references a job that is not in the spec.
#[error("bundle {bundle_id} references unknown job {job_id}")]
BundleUnknownJob {
/// Offending bundle.
bundle_id: BundleId,
/// Job that is missing.
job_id: JobId,
},
/// Bundle's parent does not exist.
#[error("bundle {bundle_id} declares unknown parent {parent}")]
BundleUnknownParent {
/// Offending bundle.
bundle_id: BundleId,
/// Parent bundle that is missing.
parent: BundleId,
},
/// Two job templates share an id.
#[error("duplicate job id {0}")]
DuplicateJob(JobId),
/// Two edge templates share an id.
#[error("duplicate edge id {0}")]
DuplicateEdge(EdgeId),
/// Two bundle templates share an id.
#[error("duplicate bundle id {0}")]
DuplicateBundle(BundleId),
/// A job kind is not registered with the [`super::registry::HandlerRegistry`].
#[error("job {job_id} kind {kind:?} is not registered with the handler registry")]
UnknownKind {
/// Job whose kind is missing.
job_id: JobId,
/// The kind string.
kind: String,
},
}