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 asGAS.create_dataset()
GAS.list_dataset_names()
andGAS.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 orFusionDatasetClient
instance (is_fusion=True), and the status of dataset client is “commit”.
- create_auth_dataset(name: str, config_name: 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.
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 orFusionDatasetClient
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 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() 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) 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
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
OperationError – When uploading the dataset based on both draft number and branch name is not allowed.
Exception – When Exception was raised during uploading dataset.