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 asGAS.create_dataset()
GAS.list_dataset_names()
andGAS.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
- 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
- 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
- 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
- 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
- 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
- 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 orFusionDatasetClient
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 orFusionDatasetClient
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
- 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
orFusionDataset
, which includes:Create a TensorBay dataset with the name and type of input local dataset.
Upload all
Segment
orFusionSegment
in the dataset to TensorBay.
- Parameters
dataset – The
Dataset
orFusionDataset
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
orFusionDatasetClient
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.