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.

delete_storage_config(name: str) None[source]

Delete a storage config in TensorBay.

Parameters

name – Name of the storage config, unique for a team.

create_oss_storage_config(name: str, file_path: str, *, endpoint: str, accesskey_id: str, accesskey_secret: str, bucket_name: str) tensorbay.client.cloud_storage.CloudClient[source]

Create an oss auth storage config.

Parameters
  • name – The required auth storage config name.

  • file_path – dataset storage path of the bucket.

  • endpoint – endpoint of the oss.

  • accesskey_id – accesskey_id of the oss.

  • accesskey_secret – accesskey_secret of the oss.

  • bucket_name – bucket_name of the oss.

Returns

The cloud client of this dataset.

create_s3_storage_config(name: str, file_path: str, *, endpoint: str, accesskey_id: str, accesskey_secret: str, bucket_name: str) tensorbay.client.cloud_storage.CloudClient[source]

Create a s3 auth storage config.

Parameters
  • name – The required auth storage config name.

  • file_path – dataset storage path of the bucket.

  • endpoint – endpoint of the s3.

  • accesskey_id – accesskey_id of the s3.

  • accesskey_secret – accesskey_secret of the s3.

  • bucket_name – bucket_name of the s3.

Returns

The cloud client of this dataset.

create_azure_storage_config(name: str, file_path: str, *, account_type: str, account_name: str, account_key: str, container_name: str) tensorbay.client.cloud_storage.CloudClient[source]

Create an azure auth storage config.

Parameters
  • name – The required auth storage config name.

  • file_path – dataset storage path of the bucket.

  • account_type – account type of azure, only support “China” and “Global”.

  • account_name – account name of the azure.

  • account_key – account key of the azure.

  • container_name – container name of the azure.

Returns

The cloud client of this dataset.

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, *, config_name: Optional[str] = 'None', alias: str = "''") tensorbay.client.dataset.DatasetClient[source]
create_dataset(name: str, is_fusion: typing_extensions.Literal[True], *, config_name: Optional[str] = 'None', alias: str = "''") tensorbay.client.dataset.FusionDatasetClient
create_dataset(name: str, is_fusion: bool = False, *, config_name: 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.

  • config_name – The auth storage config name.

  • 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, is_fusion: bool = False, *, config_name: Optional[str] = None, alias: str = '') Union[tensorbay.client.dataset.DatasetClient, tensorbay.client.dataset.FusionDatasetClient][source]

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

Deprecated since version 1.12.0: Will be removed in version 1.15.0. Use create_dataset() instead.

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.

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

  • config_name – The auth storage config name.

  • 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: Optional[str] = None, is_public: Optional[bool] = None) None[source]

Update a TensorBay Dataset.

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

  • alias – New alias of the dataset.

  • is_public – Whether the dataset is public.

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
  • ValueError – 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.