Skip to content
Merged
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
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 2 additions & 0 deletions tests/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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),
)

Expand Down
1 change: 1 addition & 0 deletions wherobots/db/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion wherobots/db/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
)
Expand All @@ -105,6 +109,7 @@ def connect(
json={
"runtimeId": runtime.value,
"shutdownAfterInactiveSeconds": shutdown_after_inactive_seconds,
"version": version,
"sessionType": session_type.value,
},
headers=headers,
Expand Down