Skip to content

Commit 65d34e2

Browse files
committed
feat: add support for runtime version parameter
1 parent 39acfe0 commit 65d34e2

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,16 @@ users may find useful:
9494
client application. The default is EWKT (string) and the most
9595
convenient for human inspection while still being usable by
9696
libraries like Shapely.
97-
* `session_type`: `"single"` or `"multi"`; if set to `"single"`, then each call
98-
to `connect()` establishes an exclusive connection to a distinct and dedicated
99-
Wherobots runtime; if set to "multi", then multiple `connect()` calls with the
100-
same arguments and credentials will connect to the same shared Wherobots runtime;
101-
`"single"` is the default.
102-
103-
Consider multi-session for potential cost savings, but be mindful of
104-
performance impacts from shared resources. You might need to adjust
105-
cluster size if slowdowns occur, which could affect overall cost.
97+
* `version`: one of the WherobotsDB runtime versions that is available
98+
to you, if you need to pin your usage to a particular, supported
99+
WherobotsDB version. Defaults to `"latest"`.
100+
* `session_type`: `"single"` or `"multi"`; if set to `"single"`, then
101+
each call to `connect()` establishes an exclusive connection to a
102+
distinct and dedicated Wherobots runtime; if set to "multi", then
103+
multiple `connect()` calls with the same arguments and credentials
104+
will connect to the same shared Wherobots runtime; `"multi"` is the
105+
default.
106+
107+
Consider multi-session for potential cost savings, but be mindful of
108+
performance impacts from shared resources. You might need to adjust
109+
cluster size if slowdowns occur, which could affect overall cost.

tests/smoke.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
parser.add_argument("--api-key-file", help="File containing the API key")
2222
parser.add_argument("--token-file", help="File containing the token")
2323
parser.add_argument("--region", help="Region to connect to (ie. aws-us-west-2)")
24+
parser.add_argument("--version", help="Runtime version (ie. latest)")
2425
parser.add_argument(
2526
"--session-type",
2627
help="Type of session to create",
@@ -83,6 +84,7 @@
8384
shutdown_after_inactive_seconds=args.shutdown_after_inactive_seconds,
8485
wait_timeout=900,
8586
region=Region(args.region) if args.region else Region.AWS_US_WEST_2,
87+
version=args.version,
8688
session_type=SessionType(args.session_type),
8789
)
8890

wherobots/db/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
DEFAULT_RUNTIME: Runtime = Runtime.TINY
1414
DEFAULT_REGION: Region = Region.AWS_US_WEST_2
15+
DEFAULT_VERSION: str = "latest"
1516
DEFAULT_SESSION_TYPE: SessionType = SessionType.MULTI
1617
DEFAULT_READ_TIMEOUT_SECONDS: float = 0.25
1718
DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS: float = 900

wherobots/db/driver.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
DEFAULT_READ_TIMEOUT_SECONDS,
2525
DEFAULT_SESSION_TYPE,
2626
DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
27+
DEFAULT_VERSION,
2728
MAX_MESSAGE_SIZE,
2829
PARAM_STYLE,
2930
PROTOCOL_VERSION,
@@ -63,6 +64,7 @@ def connect(
6364
api_key: Union[str, None] = None,
6465
runtime: Union[Runtime, None] = None,
6566
region: Union[Region, None] = None,
67+
version: Union[str, None] = None,
6668
wait_timeout: float = DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS,
6769
read_timeout: float = DEFAULT_READ_TIMEOUT_SECONDS,
6870
session_type: Union[SessionType, None] = None,
@@ -85,11 +87,13 @@ def connect(
8587
host = host or DEFAULT_ENDPOINT
8688
runtime = runtime or DEFAULT_RUNTIME
8789
region = region or DEFAULT_REGION
90+
version = version or DEFAULT_VERSION
8891
session_type = session_type or DEFAULT_SESSION_TYPE
8992

9093
logging.info(
91-
"Requesting %s runtime in %s from %s ...",
94+
"Requesting %s runtime running %s in %s from %s ...",
9295
runtime.value,
96+
version,
9397
region.value,
9498
host,
9599
)
@@ -105,6 +109,7 @@ def connect(
105109
json={
106110
"runtimeId": runtime.value,
107111
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,
112+
"version": version,
108113
"sessionType": session_type.value,
109114
},
110115
headers=headers,

0 commit comments

Comments
 (0)