tensorbay.client.gas

Class GAS.

The GAS defines the initial client to interact between local and TensorBay. It provides some operations on datasets level such as GAS.create_dataset(), GAS.list_dataset_names() and GAS.get_dataset().

AccessKey is required when operating with dataset.

class tensorbay.client.gas.GAS(access_key: str, url: str = '')[source]

Bases: object

GAS defines the initial client to interact between local and TensorBay.

GAS provides some operations on dataset level such as GAS.create_dataset() GAS.list_dataset_names() and GAS.get_dataset().

Parameters
  • access_key – User’s access key.

  • url – The host URL of the gas website.

get_user() tensorbay.client.struct.UserInfo[source]

Get the user information with the current accesskey.

Returns

The struct.UserInfo with the current accesskey.

get_auth_storage_config(name: str) Dict[str, Any][source]

Get the auth storage config with the given name.

Parameters

name – The required auth storage config name.

Returns

The auth storage config with the given name.

Raises
  • TypeError – When the given auth storage config is illegal.

  • ResourceNotExistError – When the required auth storage config does not exist.

list_auth_storage_configs() tensorbay.client.lazy.PagingList[Dict[str, Any]][source]

List auth storage configs.

Returns

The PagingList of all auth storage configs.

get_cloud_client(name: str) tensorbay.client.cloud_storage.CloudClient[source]

Get a cloud client used for interacting with cloud platform.

Parameters

name – The required auth storage config name.

Returns

The cloud client of this dataset.

create_dataset(name: str, is_fusion: typing_extensions.Literal[False] = False, *, region: Optional[str] = 'None', alias: str = "''") tensorbay.client.dataset.DatasetClient[source]
create_dataset(name: str, is_fusion: typing_extensions.Literal[True], *, region: Optional[str] = 'None', alias: str = "''") tensorbay.client.dataset.FusionDatasetClient
create_dataset(name: str, is_fusion: bool = False, *, region: Optional[str] = 'None', alias: str = "''") Union[tensorbay.client.dataset.DatasetClient, tensorbay.client.dataset.FusionDatasetClient]

Create a TensorBay dataset with given name.

Parameters
  • name – Name of the dataset, unique for a user.

  • is_fusion – Whether the dataset is a fusion dataset, True for fusion dataset.

  • region – Region of the dataset to be stored, only support “beijing”, “hangzhou”, “shanghai”, default is “shanghai”.

  • alias – Alias of the dataset, default is “”.

Returns

The created DatasetClient instance or FusionDatasetClient instance (is_fusion=True), and the status of dataset client is “commit”.

create_auth_dataset(name: str, config_name: str, path: str, *, is_fusion: bool = False, alias: str = '') Union[tensorbay.client.dataset.DatasetClient, tensorbay.client.dataset.FusionDatasetClient][source]

Create a TensorBay dataset with given name in auth cloud storage.

The dataset will be linked to the given auth cloud storage

and all of relative data will be stored in auth cloud storage.

Parameters
  • name – Name of the dataset, unique for a user.

  • config_name – The auth storage config name.

  • path – The path of the dataset to create in auth cloud storage.

  • is_fusion – Whether the dataset is a fusion dataset, True for fusion dataset.

  • alias – Alias of the dataset, default is “”.

Returns

The created DatasetClient instance or FusionDatasetClient instance (is_fusion=True), and the status of dataset client is “commit”.

get_dataset(name: str, is_fusion: typing_extensions.Literal[False] = False) tensorbay.client.dataset.DatasetClient[source]
get_dataset(name: str, is_fusion: typing_extensions.Literal[True]) tensorbay.client.dataset.FusionDatasetClient
get_dataset(name: str, is_fusion: bool = False) Union[tensorbay.client.dataset.DatasetClient, tensorbay.client.dataset.FusionDatasetClient]

Get a TensorBay dataset with given name and commit ID.

Parameters
  • name – The name of the requested dataset.

  • is_fusion – Whether the dataset is a fusion dataset, True for fusion dataset.

Returns

The requested DatasetClient instance or FusionDatasetClient instance (is_fusion=True), and the status of dataset client is “commit”.

Raises

DatasetTypeError – When the requested dataset type is not the same as given.

list_dataset_names() tensorbay.client.lazy.PagingList[str][source]

List names of all TensorBay datasets.

Returns

The PagingList of all TensorBay dataset names.

update_dataset(name: str, *, alias: str = Ellipsis) None[source]

Update a TensorBay Dataset.

Parameters
  • name – Name of the dataset, unique for a user.

  • alias – New alias of the dataset.

rename_dataset(name: str, new_name: str) None[source]

Rename a TensorBay Dataset with given name.

Parameters
  • name – Name of the dataset, unique for a user.

  • new_name – New name of the dataset, unique for a user.

upload_dataset(dataset: tensorbay.dataset.dataset.Dataset, draft_number: Optional[int] = None, *, branch_name: Optional[str] = 'None', jobs: int = '1', skip_uploaded_files: bool = 'False', quiet: bool = 'False') tensorbay.client.dataset.DatasetClient[source]
upload_dataset(dataset: tensorbay.dataset.dataset.FusionDataset, draft_number: Optional[int] = None, *, branch_name: Optional[str] = 'None', jobs: int = '1', skip_uploaded_files: bool = 'False', quiet: bool = 'False') tensorbay.client.dataset.FusionDatasetClient
upload_dataset(dataset: Union[tensorbay.dataset.dataset.Dataset, tensorbay.dataset.dataset.FusionDataset], draft_number: Optional[int] = None, *, branch_name: Optional[str] = 'None', jobs: int = '1', skip_uploaded_files: bool = 'False', quiet: bool = 'False') Union[tensorbay.client.dataset.DatasetClient, tensorbay.client.dataset.FusionDatasetClient]

Upload a local dataset to TensorBay.

This function will upload all information contains in the Dataset or FusionDataset, which includes:

  • Create a TensorBay dataset with the name and type of input local dataset.

  • Upload all Segment or FusionSegment in the dataset to TensorBay.

Parameters
  • dataset – The Dataset or FusionDataset needs to be uploaded.

  • draft_number – The draft number.

  • branch_name – The branch name.

  • jobs – The number of the max workers in multi-thread upload.

  • skip_uploaded_files – Set it to True to skip the uploaded files.

  • quiet – Set to True to stop showing the upload process bar.

Returns

The DatasetClient or FusionDatasetClient bound with the uploaded dataset.

Raises
  • OperationError – When uploading the dataset based on both draft number and branch name is not allowed.

  • Exception – When Exception was raised during uploading dataset.

delete_dataset(name: str) None[source]

Delete a TensorBay dataset with given name.

Parameters

name – Name of the dataset, unique for a user.