Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ users may find useful:
Consider multi-session for potential cost savings, but be mindful of
performance impacts from shared resources. You might need to adjust
cluster size if slowdowns occur, which could affect overall cost.
* `force_new`: passing `force_new=True` forces Wherobots Cloud to create
and start a new SQL Session runtime for this connection instead of
attempting to reuse an existing, available one. Note that this can
severely impact the delay in obtaining a connection to your runtime.
* `shutdown_after_inactive_seconds`: how long the runtime waits and
stays running after all clients have disconnected. This delay gives
an opportunity for clients to reconnect to a previously-established
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "wherobots-python-dbapi"
version = "0.20.0"
version = "0.21.0"
description = "Python DB-API driver for Wherobots DB"
authors = [{ name = "Maxime Petazzoni", email = "max@wherobots.com" }]
requires-python = ">=3.8, <4"
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions wherobots/db/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def connect(
wait_timeout: float = DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
read_timeout: float = DEFAULT_READ_TIMEOUT_SECONDS,
session_type: Union[SessionType, None] = None,
force_new: bool = False,
shutdown_after_inactive_seconds: Union[int, None] = None,
results_format: Union[ResultsFormat, None] = None,
data_compression: Union[DataCompression, None] = None,
Expand All @@ -91,7 +92,8 @@ def connect(
session_type = session_type or DEFAULT_SESSION_TYPE

logging.info(
"Requesting %s runtime running %s in %s from %s ...",
"Requesting %s%s runtime running %s in %s from %s ...",
"new " if force_new else "",
runtime.value,
version,
region.value,
Expand All @@ -105,7 +107,7 @@ def connect(
try:
resp = requests.post(
url=f"{host}/sql/session",
params={"region": region.value},
params={"region": region.value, "force_new": force_new},
json={
"runtimeId": runtime.value,
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,
Expand Down
1 change: 1 addition & 0 deletions wherobots/db/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Runtime(Enum):
XXXX_LARGE_HIMEM = "4x-large-himem"

# GPU
MICRO_A10_GPU = "micro-a10-gpu"
TINY_A10_GPU = "tiny-a10-gpu"
SMALL_A10_GPU = "small-a10-gpu"
MEDIUM_A10_GPU = "medium-a10-gpu"
Expand Down