-
Notifications
You must be signed in to change notification settings - Fork 3
/
exceptions.py
47 lines (29 loc) · 1.26 KB
/
exceptions.py
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
from typing import Iterable
class AdagioError(Exception):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class WorkflowBug(AdagioError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class CompileError(AdagioError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class DependencyDefinitionError(CompileError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class DependencyNotDefinedError(DependencyDefinitionError):
def __init__(self, name: str, expected: Iterable[str], actual: Iterable[str]):
s = f"expected {sorted(expected)}, actual {sorted(actual)}"
super().__init__(f"Task {name} dependencies not well defined: " + s)
class WorkflowRuntimeError(AdagioError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class AbortedError(WorkflowRuntimeError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
class SkippedError(WorkflowRuntimeError):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def assert_on_compile(bool_expr: bool, msg: str) -> None:
if not bool_expr:
raise CompileError(msg)