Skip to content

Commit 1d64150

Browse files
committed
feat: expose force_new
1 parent 71a49ab commit 1d64150

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ users may find useful:
114114
Consider multi-session for potential cost savings, but be mindful of
115115
performance impacts from shared resources. You might need to adjust
116116
cluster size if slowdowns occur, which could affect overall cost.
117+
* `force_new`: passing `force_new=True` forces Wherobots Cloud to create
118+
and start a new SQL Session runtime for this connection instead of
119+
attempting to reuse an existing, available one. Note that this can
120+
severely impact the delay in obtaining a connection to your runtime.
117121
* `shutdown_after_inactive_seconds`: how long the runtime waits and
118122
stays running after all clients have disconnected. This delay gives
119123
an opportunity for clients to reconnect to a previously-established

wherobots/db/driver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def connect(
6868
wait_timeout: float = DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
6969
read_timeout: float = DEFAULT_READ_TIMEOUT_SECONDS,
7070
session_type: Union[SessionType, None] = None,
71+
force_new: bool = False,
7172
shutdown_after_inactive_seconds: Union[int, None] = None,
7273
results_format: Union[ResultsFormat, None] = None,
7374
data_compression: Union[DataCompression, None] = None,
@@ -91,7 +92,8 @@ def connect(
9192
session_type = session_type or DEFAULT_SESSION_TYPE
9293

9394
logging.info(
94-
"Requesting %s runtime running %s in %s from %s ...",
95+
"Requesting %s%s runtime running %s in %s from %s ...",
96+
"new " if force_new else "",
9597
runtime.value,
9698
version,
9799
region.value,
@@ -105,7 +107,7 @@ def connect(
105107
try:
106108
resp = requests.post(
107109
url=f"{host}/sql/session",
108-
params={"region": region.value},
110+
params={"region": region.value, "force_new": force_new},
109111
json={
110112
"runtimeId": runtime.value,
111113
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,

0 commit comments

Comments
 (0)