|
1 | | -from enum import auto |
2 | 1 | from packaging.version import Version |
3 | | -from strenum import LowercaseStrEnum, StrEnum |
4 | 2 |
|
5 | 3 | from .region import Region |
6 | 4 | from .runtime import Runtime |
7 | 5 | from .session_type import SessionType |
8 | | -from .store import StorageFormat |
| 6 | +from .types import StorageFormat |
9 | 7 |
|
10 | 8 |
|
11 | 9 | DEFAULT_ENDPOINT: str = "api.cloud.wherobots.com" # "api.cloud.wherobots.com" |
|
22 | 20 | PROTOCOL_VERSION: Version = Version("1.0.0") |
23 | 21 |
|
24 | 22 | PARAM_STYLE = "pyformat" |
25 | | - |
26 | | - |
27 | | -class ExecutionState(LowercaseStrEnum): |
28 | | - IDLE = auto() |
29 | | - "Not executing any operation." |
30 | | - |
31 | | - EXECUTION_REQUESTED = auto() |
32 | | - "Execution of a query has been requested by the driver." |
33 | | - |
34 | | - RUNNING = auto() |
35 | | - "The SQL session has reported the query is running." |
36 | | - |
37 | | - SUCCEEDED = auto() |
38 | | - "The SQL session has reported the query has completed successfully." |
39 | | - |
40 | | - CANCELLED = auto() |
41 | | - "The SQL session has reported the query has been cancelled." |
42 | | - |
43 | | - FAILED = auto() |
44 | | - "The SQL session has reported the query has failed." |
45 | | - |
46 | | - RESULTS_REQUESTED = auto() |
47 | | - "The driver has requested the query results from the SQL session." |
48 | | - |
49 | | - COMPLETED = auto() |
50 | | - "The driver has completed processing the query results." |
51 | | - |
52 | | - def is_terminal_state(self) -> bool: |
53 | | - return self in ( |
54 | | - ExecutionState.COMPLETED, |
55 | | - ExecutionState.CANCELLED, |
56 | | - ExecutionState.FAILED, |
57 | | - ) |
58 | | - |
59 | | - |
60 | | -class RequestKind(LowercaseStrEnum): |
61 | | - EXECUTE_SQL = auto() |
62 | | - RETRIEVE_RESULTS = auto() |
63 | | - CANCEL = auto() |
64 | | - |
65 | | - |
66 | | -class EventKind(LowercaseStrEnum): |
67 | | - STATE_UPDATED = auto() |
68 | | - EXECUTION_RESULT = auto() |
69 | | - ERROR = auto() |
70 | | - |
71 | | - |
72 | | -class ResultsFormat(LowercaseStrEnum): |
73 | | - JSON = auto() |
74 | | - ARROW = auto() |
75 | | - |
76 | | - |
77 | | -class DataCompression(LowercaseStrEnum): |
78 | | - BROTLI = auto() |
79 | | - |
80 | | - |
81 | | -class GeometryRepresentation(LowercaseStrEnum): |
82 | | - WKT = auto() |
83 | | - WKB = auto() |
84 | | - EWKT = auto() |
85 | | - EWKB = auto() |
86 | | - GEOJSON = auto() |
87 | | - |
88 | | - |
89 | | -class AppStatus(StrEnum): |
90 | | - PENDING = auto() |
91 | | - PREPARING = auto() |
92 | | - PREPARE_FAILED = auto() |
93 | | - REQUESTED = auto() |
94 | | - DEPLOYING = auto() |
95 | | - DEPLOY_FAILED = auto() |
96 | | - DEPLOYED = auto() |
97 | | - INITIALIZING = auto() |
98 | | - INIT_FAILED = auto() |
99 | | - READY = auto() |
100 | | - DESTROY_REQUESTED = auto() |
101 | | - DESTROYING = auto() |
102 | | - DESTROY_FAILED = auto() |
103 | | - DESTROYED = auto() |
104 | | - |
105 | | - def is_starting(self) -> bool: |
106 | | - return self in ( |
107 | | - AppStatus.PENDING, |
108 | | - AppStatus.PREPARING, |
109 | | - AppStatus.REQUESTED, |
110 | | - AppStatus.DEPLOYING, |
111 | | - AppStatus.DEPLOYED, |
112 | | - AppStatus.INITIALIZING, |
113 | | - ) |
114 | | - |
115 | | - def is_terminal_state(self) -> bool: |
116 | | - return self in ( |
117 | | - AppStatus.PREPARE_FAILED, |
118 | | - AppStatus.DEPLOY_FAILED, |
119 | | - AppStatus.INIT_FAILED, |
120 | | - AppStatus.DESTROY_FAILED, |
121 | | - AppStatus.DESTROYED, |
122 | | - ) |
0 commit comments