forked from feldera/feldera
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenums.py
More file actions
183 lines (143 loc) · 5.93 KB
/
enums.py
File metadata and controls
183 lines (143 loc) · 5.93 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
from enum import Enum
class CompilationProfile(Enum):
"""
The compilation profile to use when compiling the program.
"""
SERVER_DEFAULT = None
"""
The compiler server default compilation profile.
"""
DEV = "dev"
"""
The development compilation profile.
"""
UNOPTIMIZED = "unoptimized"
"""
The unoptimized compilation profile.
"""
OPTIMIZED = "optimized"
"""
The optimized compilation profile, the default for this API.
"""
class BuildMode(Enum):
CREATE = 1
GET = 2
GET_OR_CREATE = 3
class PipelineStatus(Enum):
"""
Represents the state that this pipeline is currently in.
.. code-block:: text
Shutdown ◄────┐
│ │
/deploy │ │
│ ⌛ShuttingDown
▼ ▲
⌛Provisioning │
│ │
Provisioned │
▼ │/shutdown
⌛Initializing │
│ │
┌────────┴─────────┴─┐
│ ▼ │
│ Paused │
│ │ ▲ │
│/start│ │/pause │
│ ▼ │ │
│ Running │
└──────────┬─────────┘
│
▼
Failed
"""
NOT_FOUND = 1
"""
The pipeline has not been created yet.
"""
SHUTDOWN = 2
"""
Pipeline has not been started or has been shut down.
The pipeline remains in this state until the user triggers
a deployment by invoking the `/deploy` endpoint.
"""
PROVISIONING = 3
"""
The runner triggered a deployment of the pipeline and is
waiting for the pipeline HTTP server to come up.
In this state, the runner provisions a runtime for the pipeline,
starts the pipeline within this runtime and waits for it to start accepting HTTP requests.
The user is unable to communicate with the pipeline during this
time. The pipeline remains in this state until:
1. Its HTTP server is up and running; the pipeline transitions to the
`PipelineStatus.INITIALIZING` state.
2. A pre-defined timeout has passed. The runner performs forced
shutdown of the pipeline; returns to the `PipelineStatus.SHUTDOWN` state.
3. The user cancels the pipeline by invoking the `/shutdown` endpoint.
The manager performs forced shutdown of the pipeline, returns to the
`PipelineStatus.SHUTDOWN` state.
"""
INITIALIZING = 4
"""
The pipeline is initializing its internal state and connectors.
This state is part of the pipeline's deployment process. In this state,
the pipeline's HTTP server is up and running, but its query engine
and input and output connectors are still initializing.
The pipeline remains in this state until:
1. Initialization completes successfully; the pipeline transitions to the
`PipelineStatus.PAUSED` state.
2. Initialization fails; transitions to the `PipelineStatus.FAILED` state.
3. A pre-defined timeout has passed. The runner performs forced
shutdown of the pipeline; returns to the `PipelineStatus.SHUTDOWN` state.
4. The user cancels the pipeline by invoking the `/shutdown` endpoint.
The manager performs forced shutdown of the pipeline; returns to the
`PipelineStatus.SHUTDOWN` state.
"""
PAUSED = 5
"""
The pipeline is fully initialized, but data processing has been paused.
The pipeline remains in this state until:
1. The user starts the pipeline by invoking the `/start` endpoint. The
manager passes the request to the pipeline; transitions to the
`PipelineStatus.RUNNING` state.
2. The user cancels the pipeline by invoking the `/shutdown` endpoint.
The manager passes the shutdown request to the pipeline to perform a
graceful shutdown; transitions to the `PipelineStatus.SHUTTING_DOWN` state.
3. An unexpected runtime error renders the pipeline `PipelineStatus.FAILED`.
"""
RUNNING = 6
"""
The pipeline is processing data.
The pipeline remains in this state until:
1. The user pauses the pipeline by invoking the `/pause` endpoint. The
manager passes the request to the pipeline; transitions to the
`PipelineStatus.PAUSED` state.
2. The user cancels the pipeline by invoking the `/shutdown` endpoint.
The runner passes the shutdown request to the pipeline to perform a
graceful shutdown; transitions to the
`PipelineStatus.SHUTTING_DOWN` state.
3. An unexpected runtime error renders the pipeline
`PipelineStatus.FAILED`.
"""
SHUTTING_DOWN = 7
"""
Graceful shutdown in progress.
In this state, the pipeline finishes any ongoing data processing,
produces final outputs, shuts down input/output connectors and
terminates.
The pipeline remains in this state until:
1. Shutdown completes successfully; transitions to the `PipelineStatus.SHUTDOWN` state.
2. A pre-defined timeout has passed. The manager performs forced shutdown of the pipeline; returns to the
`PipelineStatus.SHUTDOWN` state.
"""
FAILED = 8
"""
The pipeline remains in this state until the users acknowledge the failure
by issuing a call to shutdown the pipeline; transitions to the
`PipelineStatus.SHUTDOWN` state.
"""
@staticmethod
def from_str(value):
for member in PipelineStatus:
if member.name.lower() == value.lower():
return member
raise ValueError(f"Unknown value '{value}' for enum {PipelineStatus.__name__}")