tensorbay.client.gas#

The implementation of the gas.

class tensorbay.client.gas.GAS(access_key, url='')[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 (str) – User’s access key.

  • url (str) – The host URL of the gas website.

Return type

None

get_user()[source]#

Get the user information with the current accesskey.

Returns

The struct.UserInfo with the current accesskey.

Return type

tensorbay.client.struct.UserInfo

get_auth_storage_config(name)[source]#

Get the auth storage config with the given name.

Parameters

name (str) – 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.

Return type

tensorbay.client.cloud_storage.StorageConfig

list_auth_storage_configs()[source]#

List auth storage configs.

Returns

The PagingList of all auth storage configs.

Return type

tensorbay.client.lazy.PagingList[tensorbay.client.cloud_storage.StorageConfig]

delete_storage_config(name)[source]#

Delete a storage config in TensorBay.

Parameters

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

Return type

None

create_oss_storage_config(name, file_path, *, endpoint, accesskey_id, accesskey_secret, bucket_name)[source]#

Create an oss auth storage config.

Parameters
  • name (str) – The required auth storage config name.

  • file_path (str) – dataset storage path of the bucket.

  • endpoint (str) – endpoint of the oss.

  • accesskey_id (str) – accesskey_id of the oss.

  • accesskey_secret (str) – accesskey_secret of the oss.

  • bucket_name (str) – bucket_name of the oss.

Returns

The cloud client of this dataset.

Return type

tensorbay.client.cloud_storage.CloudClient

create_s3_storage_config(name, file_path, *, endpoint, accesskey_id, accesskey_secret, bucket_name)[source]#

Create a s3 auth storage config.

Parameters
  • name (str) – The required auth storage config name.

  • file_path (str) – dataset storage path of the bucket.

  • endpoint (str) – endpoint of the s3.

  • accesskey_id (str) – accesskey_id of the s3.

  • accesskey_secret (str) – accesskey_secret of the s3.

  • bucket_name (str) – bucket_name of the s3.

Returns

The cloud client of this dataset.

Return type

tensorbay.client.cloud_storage.CloudClient

create_azure_storage_config(name, file_path, *, account_type, account_name, account_key, container_name)[source]#

Create an azure auth storage config.

Parameters
  • name (str) – The required auth storage config name.

  • file_path (str) – dataset storage path of the bucket.

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

  • account_name (str) – account name of the azure.

  • account_key (str) – account key of the azure.

  • container_name (str) – container name of the azure.

Returns

The cloud client of this dataset.

Return type

tensorbay.client.cloud_storage.CloudClient

create_local_storage_config(name, file_path, endpoint)[source]#

Create a local auth storage config.

Parameters
  • name (str) – The required local storage config name.

  • file_path (str) – The dataset storage path under the local storage.

  • endpoint (str) – The external IP address of the local storage.

Return type

None

get_cloud_client(name)[source]#

Get a cloud client used for interacting with cloud platform.

Parameters

name (str) – The required auth storage config name.

Returns

The cloud client of this dataset.

Return type

tensorbay.client.cloud_storage.CloudClient

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

  • is_public – Whether the dataset is a public dataset.

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: Literal[False] = False) tensorbay.client.dataset.DatasetClient[source]#
get_dataset(name: str, is_fusion: 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()[source]#

List names of all TensorBay datasets.

Returns

The PagingList of all TensorBay dataset names.

Return type

tensorbay.client.lazy.PagingList[str]

update_dataset(name, *, alias=None, is_public=None)[source]#

Update a TensorBay Dataset.

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

  • alias (Optional[str]) – New alias of the dataset.

  • is_public (Optional[bool]) – Whether the dataset is public.

Return type

None

rename_dataset(name, new_name)[source]#

Rename a TensorBay Dataset with given name.

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

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

Return type

None

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)[source]#

Delete a TensorBay dataset with given name.

Parameters

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

Return type

None