Context framework¶
Configuration options for TensorStore drivers are specified using a context framework, which allows resources such as cache pools, concurrent execution pools, and authentication credentials to be specified using JSON in a way that allows sharing of resources by multiple TensorStore drivers.
- json Context : object¶
A context JSON object is a mapping of resource identifiers to
ContextResource
specifications.- Optional members:¶
- <resource-type> : ContextResource¶
Overrides the default resource for the given
<resource-type>
, which must be a supported resource type.
- <resource-type>#<id> : ContextResource¶
Defines a resource with identifier
<id>
of the given<resource-type>
. The resource specification must be compatible with<resource-type>
.
Example
{ "cache_pool": {"total_bytes_limit": 10000000}, "cache_pool#remote": {"total_bytes_limit": 100000000}, "data_copy_concurrency": {"limit": 8} }
-
json ContextResource : object | string |
null
¶ Specifies a context resource of a particular
<resource-type>
.- One of:¶
- object
Specifies the resource directly. All members are specific to the particular
<resource-type>
.
- string
References another resource of the same type in the current or parent context using the syntax
"<resource-type>"
or"<resource-type>#<id>"
, where<resource-type>
matches the type of this resource.
-
null
Specifies a new instance of the default resource of the given
<resource-type>
. Only valid within aContext
specification.
- json Context.cache_pool : object¶
Specifies the size of an in-memory Least Recently Used (LRU) cache. Each
cache_pool
resource specifies a separate memory pool.- Optional members:¶
-
total_bytes_limit : integer[
0
, +∞) =0
¶ Soft limit on the total number of bytes in the cache. The least-recently used data that is not in use is evicted from the cache when this limit is reached.
-
queued_for_writeback_bytes_limit : integer[
0
, +∞)¶ Soft limit on the total number of bytes of data pending writeback. Writeback is initated on the least-recently used data that is pending writeback when this limit is reached. Defaults to half of
total_bytes_limit
.
-
total_bytes_limit : integer[
- json Context.data_copy_concurrency : object¶
Specifies a limit on the number of CPU cores used concurrently for data copying/encoding/decoding.
- json Context.file_io_concurrency : object¶
Specifies a limit on the number of concurrently local filesystem I/O operations.