wherobots-python-dbapi 0.6.2__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/PKG-INFO +1 -1
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/pyproject.toml +1 -1
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/constants.py +37 -1
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/driver.py +6 -4
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/LICENSE +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/README.md +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/__init__.py +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/__init__.py +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/connection.py +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/cursor.py +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/errors.py +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/region.py +0 -0
- {wherobots_python_dbapi-0.6.2 → wherobots_python_dbapi-0.7.0}/wherobots/db/runtime.py +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from enum import auto
|
|
2
|
-
from strenum import LowercaseStrEnum
|
|
2
|
+
from strenum import LowercaseStrEnum, StrEnum
|
|
3
3
|
|
|
4
4
|
from .region import Region
|
|
5
5
|
from .runtime import Runtime
|
|
@@ -67,3 +67,39 @@ class GeometryRepresentation(LowercaseStrEnum):
|
|
|
67
67
|
EWKT = auto()
|
|
68
68
|
EWKB = auto()
|
|
69
69
|
GEOJSON = auto()
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class AppStatus(StrEnum):
|
|
73
|
+
PENDING = auto()
|
|
74
|
+
PREPARING = auto()
|
|
75
|
+
PREPARE_FAILED = auto()
|
|
76
|
+
REQUESTED = auto()
|
|
77
|
+
DEPLOYING = auto()
|
|
78
|
+
DEPLOY_FAILED = auto()
|
|
79
|
+
DEPLOYED = auto()
|
|
80
|
+
INITIALIZING = auto()
|
|
81
|
+
INIT_FAILED = auto()
|
|
82
|
+
READY = auto()
|
|
83
|
+
DESTROY_REQUESTED = auto()
|
|
84
|
+
DESTROYING = auto()
|
|
85
|
+
DESTROY_FAILED = auto()
|
|
86
|
+
DESTROYED = auto()
|
|
87
|
+
|
|
88
|
+
def is_starting(self):
|
|
89
|
+
return self in (
|
|
90
|
+
AppStatus.PENDING,
|
|
91
|
+
AppStatus.PREPARING,
|
|
92
|
+
AppStatus.REQUESTED,
|
|
93
|
+
AppStatus.DEPLOYING,
|
|
94
|
+
AppStatus.DEPLOYED,
|
|
95
|
+
AppStatus.INITIALIZING,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def is_terminal_state(self):
|
|
99
|
+
return self in (
|
|
100
|
+
AppStatus.PREPARE_FAILED,
|
|
101
|
+
AppStatus.DEPLOY_FAILED,
|
|
102
|
+
AppStatus.INIT_FAILED,
|
|
103
|
+
AppStatus.DESTROY_FAILED,
|
|
104
|
+
AppStatus.DESTROYED,
|
|
105
|
+
)
|
|
@@ -21,9 +21,10 @@ from .constants import (
|
|
|
21
21
|
DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
|
|
22
22
|
MAX_MESSAGE_SIZE,
|
|
23
23
|
PROTOCOL_VERSION,
|
|
24
|
-
|
|
24
|
+
AppStatus,
|
|
25
25
|
DataCompression,
|
|
26
26
|
GeometryRepresentation,
|
|
27
|
+
ResultsFormat,
|
|
27
28
|
)
|
|
28
29
|
from .errors import (
|
|
29
30
|
InterfaceError,
|
|
@@ -107,11 +108,11 @@ def connect(
|
|
|
107
108
|
r = requests.get(session_id_url, headers=headers)
|
|
108
109
|
r.raise_for_status()
|
|
109
110
|
payload = r.json()
|
|
110
|
-
status = payload.get("status")
|
|
111
|
+
status = AppStatus(payload.get("status"))
|
|
111
112
|
logging.info(" ... %s", status)
|
|
112
|
-
if status
|
|
113
|
+
if status.is_starting():
|
|
113
114
|
raise tenacity.TryAgain("SQL Session is not ready yet")
|
|
114
|
-
elif status ==
|
|
115
|
+
elif status == AppStatus.READY:
|
|
115
116
|
return payload["appMeta"]["url"]
|
|
116
117
|
else:
|
|
117
118
|
logging.error("SQL session creation failed: %s; should not retry.", status)
|
|
@@ -120,6 +121,7 @@ def connect(
|
|
|
120
121
|
try:
|
|
121
122
|
logging.info("Getting SQL session status from %s ...", session_id_url)
|
|
122
123
|
session_uri = get_session_uri()
|
|
124
|
+
logging.debug("SQL session URI from app status: %s", session_uri)
|
|
123
125
|
except Exception as e:
|
|
124
126
|
raise InterfaceError("Could not acquire SQL session!", e)
|
|
125
127
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|