Fluid SDK in Python
This Python package is automatically generated by the OpenAPI Generator project:
- Python >= 3.7
pip install git+https://github.com/fluid-cloudnative/fluid-client-python.git
(you may need to run pip
with root permission: sudo pip install git+https://github.com/fluid-cloudnative/fluid-client-python.git
)
Then import the package:
import fluid
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import fluid
Please follow the installation procedure and then run the following:
The following is a code sample which creates a dataset and get its status.
import logging
import sys
from kubernetes import client
from fluid import FluidK8sClient
from fluid import constants
from fluid import models
logger = logging.getLogger("fluidsdk")
stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
logger.addHandler(stream_handler)
logger.setLevel(logging.INFO)
# Output detailed debug message for fluidsdk
# logger.setLevel(logging.DEBUG)
def main():
fluid_client = FluidK8sClient()
name = "demo"
namespace = "default"
dataset = models.Dataset(
api_version=constants.API_VERSION,
kind=constants.DATASET_KIND,
metadata=client.V1ObjectMeta(
name=name,
namespace=namespace
),
spec=models.DatasetSpec(
mounts=[
models.Mount(
mount_point="https://mirrors.bit.edu.cn/apache/hbase/stable/",
name="hbase",
path="/",
)
]
)
)
try:
fluid_client.create_dataset(dataset)
except Exception as e:
raise RuntimeError(f"Failed to create dataset: {e}")
logger.info(f"Dataset \"{dataset.metadata.namespace}/{dataset.metadata.name}\" created successfully")
try:
dataset = fluid_client.get_dataset(name, namespace)
except Exception as e:
raise RuntimeError(f"Error when getting dataset \"{namespace}/{name}\": {e}")
assert type(dataset) == models.Dataset
logger.info(f"Dataset \"{namespace}/{name}\"'s phase is: {dataset.status.phase}")
if __name__ == '__main__':
main()
- APIGatewayStatus
- AlluxioCompTemplateSpec
- AlluxioFuseSpec
- AlluxioRuntime
- AlluxioRuntimeList
- AlluxioRuntimeSpec
- CacheableNodeAffinity
- CleanCachePolicy
- Condition
- Data
- DataBackup
- DataBackupList
- DataBackupSpec
- DataLoad
- DataLoadList
- DataLoadSpec
- DataMigrate
- DataMigrateList
- DataMigrateSpec
- DataProcess
- DataProcessList
- DataProcessSpec
- DataRestoreLocation
- DataToMigrate
- Dataset
- DatasetCondition
- DatasetList
- DatasetSpec
- DatasetStatus
- DatasetToMigrate
- EFCCompTemplateSpec
- EFCFuseSpec
- EFCRuntime
- EFCRuntimeList
- EFCRuntimeSpec
- EncryptOption
- EncryptOptionSource
- ExternalEndpointSpec
- ExternalStorage
- GooseFSCompTemplateSpec
- GooseFSFuseSpec
- GooseFSRuntime
- GooseFSRuntimeList
- GooseFSRuntimeSpec
- HCFSStatus
- InitFuseSpec
- InitUsersSpec
- JindoCompTemplateSpec
- JindoFuseSpec
- JindoRuntime
- JindoRuntimeList
- JindoRuntimeSpec
- JobProcessor
- JuiceFSCompTemplateSpec
- JuiceFSFuseSpec
- JuiceFSRuntime
- JuiceFSRuntimeList
- JuiceFSRuntimeSpec
- Level
- MasterSpec
- Metadata
- MetadataSyncPolicy
- Mount
- OSAdvise
- OperationRef
- OperationStatus
- PodMetadata
- Processor
- Runtime
- RuntimeCondition
- RuntimeManagement
- RuntimeStatus
- ScriptProcessor
- SecretKeySelector
- TargetDataset
- TargetDatasetWithMountPath
- TargetPath
- ThinCompTemplateSpec
- ThinFuseSpec
- ThinRuntime
- ThinRuntimeList
- ThinRuntimeProfile
- ThinRuntimeProfileList
- ThinRuntimeProfileSpec
- ThinRuntimeSpec
- TieredStore
- User
- VersionSpec
- VineyardCompTemplateSpec
- VineyardRuntime
- VineyardRuntimeList
- VineyardRuntimeSpec
- VineyardSockSpec
- VolumeSource
- WaitingStatus
All endpoints do not require authorization.