diff --git a/README.md b/README.md index de96fda..6208d19 100644 --- a/README.md +++ b/README.md @@ -94,12 +94,16 @@ users may find useful: client application. The default is EWKT (string) and the most convenient for human inspection while still being usable by libraries like Shapely. -* `session_type`: `"single"` or `"multi"`; if set to `"single"`, then each call - to `connect()` establishes an exclusive connection to a distinct and dedicated - Wherobots runtime; if set to "multi", then multiple `connect()` calls with the - same arguments and credentials will connect to the same shared Wherobots runtime; - `"single"` is the default. - - 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. +* `version`: one of the WherobotsDB runtime versions that is available + to you, if you need to pin your usage to a particular, supported + WherobotsDB version. Defaults to `"latest"`. +* `session_type`: `"single"` or `"multi"`; if set to `"single"`, then + each call to `connect()` establishes an exclusive connection to a + distinct and dedicated Wherobots runtime; if set to "multi", then + multiple `connect()` calls with the same arguments and credentials + will connect to the same shared Wherobots runtime; `"multi"` is the + default. + + 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. diff --git a/tests/smoke.py b/tests/smoke.py index c3fc5b0..9487839 100644 --- a/tests/smoke.py +++ b/tests/smoke.py @@ -21,6 +21,7 @@ parser.add_argument("--api-key-file", help="File containing the API key") parser.add_argument("--token-file", help="File containing the token") parser.add_argument("--region", help="Region to connect to (ie. aws-us-west-2)") + parser.add_argument("--version", help="Runtime version (ie. latest)") parser.add_argument( "--session-type", help="Type of session to create", @@ -83,6 +84,7 @@ shutdown_after_inactive_seconds=args.shutdown_after_inactive_seconds, wait_timeout=900, region=Region(args.region) if args.region else Region.AWS_US_WEST_2, + version=args.version, session_type=SessionType(args.session_type), ) diff --git a/wherobots/db/constants.py b/wherobots/db/constants.py index 8c3d9c7..95f2555 100644 --- a/wherobots/db/constants.py +++ b/wherobots/db/constants.py @@ -12,6 +12,7 @@ DEFAULT_RUNTIME: Runtime = Runtime.TINY DEFAULT_REGION: Region = Region.AWS_US_WEST_2 +DEFAULT_VERSION: str = "latest" DEFAULT_SESSION_TYPE: SessionType = SessionType.MULTI DEFAULT_READ_TIMEOUT_SECONDS: float = 0.25 DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS: float = 900 diff --git a/wherobots/db/driver.py b/wherobots/db/driver.py index 99a8142..9f3a6ab 100644 --- a/wherobots/db/driver.py +++ b/wherobots/db/driver.py @@ -24,6 +24,7 @@ DEFAULT_READ_TIMEOUT_SECONDS, DEFAULT_SESSION_TYPE, DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS, + DEFAULT_VERSION, MAX_MESSAGE_SIZE, PARAM_STYLE, PROTOCOL_VERSION, @@ -63,6 +64,7 @@ def connect( api_key: Union[str, None] = None, runtime: Union[Runtime, None] = None, region: Union[Region, None] = None, + version: Union[str, None] = None, wait_timeout: float = DEFAULT_SESSION_WAIT_TIMEOUT_SECONDS, read_timeout: float = DEFAULT_READ_TIMEOUT_SECONDS, session_type: Union[SessionType, None] = None, @@ -85,11 +87,13 @@ def connect( host = host or DEFAULT_ENDPOINT runtime = runtime or DEFAULT_RUNTIME region = region or DEFAULT_REGION + version = version or DEFAULT_VERSION session_type = session_type or DEFAULT_SESSION_TYPE logging.info( - "Requesting %s runtime in %s from %s ...", + "Requesting %s runtime running %s in %s from %s ...", runtime.value, + version, region.value, host, ) @@ -105,6 +109,7 @@ def connect( json={ "runtimeId": runtime.value, "shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds, + "version": version, "sessionType": session_type.value, }, headers=headers,