|
2 | 2 | # |
3 | 3 | # SPDX-License-Identifier: Apache-2.0 |
4 | 4 |
|
5 | | -from typing import Any, Dict, Optional, Type |
6 | | - |
7 | | - |
8 | | -class PipelineError(Exception): |
9 | | - pass |
10 | | - |
11 | | - |
12 | | -class PipelineRuntimeError(Exception): |
13 | | - def __init__(self, component_name: Optional[str], component_type: Optional[Type], message: str) -> None: |
14 | | - self.component_name = component_name |
15 | | - self.component_type = component_type |
16 | | - super().__init__(message) |
17 | | - |
18 | | - @classmethod |
19 | | - def from_exception(cls, component_name: str, component_type: Type, error: Exception) -> "PipelineRuntimeError": |
20 | | - """ |
21 | | - Create a PipelineRuntimeError from an exception. |
22 | | - """ |
23 | | - message = ( |
24 | | - f"The following component failed to run:\n" |
25 | | - f"Component name: '{component_name}'\n" |
26 | | - f"Component type: '{component_type.__name__}'\n" |
27 | | - f"Error: {str(error)}" |
28 | | - ) |
29 | | - return cls(component_name, component_type, message) |
30 | | - |
31 | | - @classmethod |
32 | | - def from_invalid_output(cls, component_name: str, component_type: Type, output: Any) -> "PipelineRuntimeError": |
33 | | - """ |
34 | | - Create a PipelineRuntimeError from an invalid output. |
35 | | - """ |
36 | | - message = ( |
37 | | - f"The following component returned an invalid output:\n" |
38 | | - f"Component name: '{component_name}'\n" |
39 | | - f"Component type: '{component_type.__name__}'\n" |
40 | | - f"Expected a dictionary, but got {type(output).__name__} instead.\n" |
41 | | - f"Check the component's output and ensure it is a valid dictionary." |
42 | | - ) |
43 | | - return cls(component_name, component_type, message) |
44 | | - |
45 | | - |
46 | | -class PipelineComponentsBlockedError(PipelineRuntimeError): |
47 | | - def __init__(self) -> None: |
48 | | - message = ( |
49 | | - "Cannot run pipeline - all components are blocked. " |
50 | | - "This typically happens when:\n" |
51 | | - "1. There is no valid entry point for the pipeline\n" |
52 | | - "2. There is a circular dependency preventing the pipeline from running\n" |
53 | | - "Check the connections between these components and ensure all required inputs are provided." |
54 | | - ) |
55 | | - super().__init__(None, None, message) |
56 | | - |
57 | | - |
58 | | -class PipelineConnectError(PipelineError): |
59 | | - pass |
60 | | - |
61 | | - |
62 | | -class PipelineValidationError(PipelineError): |
63 | | - pass |
64 | | - |
65 | | - |
66 | | -class PipelineDrawingError(PipelineError): |
67 | | - pass |
68 | | - |
69 | | - |
70 | | -class PipelineMaxComponentRuns(PipelineError): |
71 | | - pass |
72 | | - |
73 | | - |
74 | | -class PipelineUnmarshalError(PipelineError): |
75 | | - pass |
76 | | - |
77 | | - |
78 | | -class ComponentError(Exception): |
79 | | - pass |
80 | | - |
81 | | - |
82 | | -class ComponentDeserializationError(Exception): |
83 | | - pass |
84 | | - |
85 | | - |
86 | | -class DeserializationError(Exception): |
87 | | - pass |
88 | | - |
89 | | - |
90 | | -class SerializationError(Exception): |
91 | | - pass |
| 5 | +from typing import Any, Dict, Optional |
92 | 6 |
|
93 | 7 |
|
94 | 8 | class PipelineBreakpointException(Exception): |
|
0 commit comments