Skip to content

CAVEclient

A manager for all clients sharing common datastack and authentication information.

This client wraps all the other clients and keeps track of the things that need to be consistent across them. To instantiate a client:

client = CAVEclient(datastack_name='my_datastack',
                         server_address='www.myserver.com',
                         auth_token_file='~/.mysecrets/secrets.json')

Then

All subclients are loaded lazily and share the same datastack name, server address, and auth tokens where used.

Parameters:

Name Type Description Default
datastack_name str

Datastack name for the services. Almost all services need this and will not work if it is not passed.

None
server_address str or None

URL of the framework server. If None, chooses the default server global.daf-apis.com. Optional, defaults to None.

None
auth_token_file str or None

Path to a json file containing the auth token. If None, uses the default location. See Auth client documentation. Optional, defaults to None.

default_token_file
auth_token_key str

Dictionary key for the token in the the JSON file. Optional, default is 'token'.

'token'
auth_token str or None

Direct entry of an auth token. If None, uses the file arguments to find the token. Optional, default is None.

None
max_retries int or None

Sets the default number of retries on failed requests. Optional, by default 2.

DEFAULT_RETRIES
pool_maxsize int or None

Sets the max number of threads in a requests pool, although this value will be exceeded if pool_block is set to False. Optional, uses requests defaults if None.

None
pool_block

If True, prevents the number of threads in a requests pool from exceeding the max size. Optional, uses requests defaults (False) if None.

None
desired_resolution Iterable[float] or None

If given, should be a list or array of the desired resolution you want queries returned in useful for materialization queries.

None
info_cache

Pre-computed info cache, bypassing the lookup of datastack info from the info service. Should only be used in cases where this information is cached and thus repetitive lookups can be avoided.

None

annotation: AnnotationClientV2 property

A client for the annotation service. See client.annotation for more information.

auth: AuthClient property

A client for the auth service. See client.auth for more information.

chunkedgraph: ChunkedGraphClientV1 property

A client for the chunkedgraph service. See client.chunkedgraph for more information.

datastack_name: str property

The name of the datastack for the client.

info: InfoServiceClientV2 property

A client for the info service. See client.info for more information.

l2cache: L2CacheClientLegacy property

A client for the L2 cache service. See client.l2cache for more information.

materialize: MaterializationClientType property

A client for the materialization service. See client.materialize for more information.

schema: SchemaClientLegacy property

A client for the EM Annotation Schemas service. See client.schema for more information.

server_address property

The server address for the client.

state: JSONServiceV1 property

A client for the neuroglancer state service. See client.state for more information.

change_auth(auth_token_file=None, auth_token_key=None, auth_token=None)

Change the authentication token and reset services.

Parameters:

Name Type Description Default
auth_token_file str

New auth token json file path, by default None, which defaults to the existing state.

None
auth_token_key str

New dictionary key under which the token is stored in the json file, by default None, which defaults to the existing state.

None
auth_token str

Direct entry of a new token, by default None.

None