GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - fluid-cloudnative/fluid-client-python: Fluid Python Client

BranchesTags
Open more actions menu

Latest commit

 

History

80 Commits
80 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.openapi-generator
.openapi-generator
 
 
docs
docs
 
 
examples
examples
 
 
fluid
fluid
 
 
hack/develop
hack/develop
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.gitlab-ci.yml
.gitlab-ci.yml
 
 
.openapi-generator-ignore
.openapi-generator-ignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
git_push.sh
git_push.sh
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 
test-requirements.txt
test-requirements.txt
 
 
tox.ini
tox.ini
 
 

Repository files navigation

Fluid Python SDK

Fluid SDK in Python

This Python package is automatically generated by the OpenAPI Generator project:

Requirements.

  • Python >= 3.7

Installation & Usage

pip install

pip install fluid-pysdk

(you may need to run pip with root permission: sudo pip install fluid-pysdk)

Getting Started

Fluid Python SDK provides two types of "client SDK" for users with different expertises and preference.

  • fluid.FluidClient (the recommended one) provides a more Pythonic interface with polished user experience.
  • fluid.FluidK8sClient provides a low-level YAML-style interface for those who have rich experience in Kubernetes.

The following shows the same code example using two types of client SDK. The example simply creates a dataset and get its status.

with fluid.FluidClient

import logging
import sys

from fluid import FluidClient, ClientConfig

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)

def main():
    name = "demo"
    namespace = "default"
    
    client_config = ClientConfig(namespace=namespace)
    fluid_client = FluidClient(client_config)
    
    
    try:
        fluid_client.create_dataset(name, "hbase", "https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/stable/", "/")
    except Exception as e:
       raise RuntimeError(f"Failed to create dataset: {e}") 
    
    logger.info(f"Dataset \"{namespace}/{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}")
    else:
        logger.info(f"Dataset \"{namespace}/{name}\"'s phase is: {dataset.report_status(status_type='binding_status')['phase']}")

if __name__ == '__main__':
    main()

with fluid.FluidK8sClient

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.tuna.tsinghua.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()

Versioning

Fluid Python SDK's version ALWAYS follows the Fluid's version as long as they share the fully compatible APIs. For example, if a released version of Fluid is v1.0.1, Fluid Python SDK with version prefix "v1.0.1" is guaranteed to have same APIs as the released Fluid version.

Fluid Python SDK may have "post" version that updates the inner code but keep the APIs untouched (e.g. hotfixes). For example, "v1.0.1.post1" is a post version of "v1.0.1" which includes the latest changes.

Documentation For Models

  • 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

Documentation For Authorization

All endpoints do not require authorization.

Author

About

Fluid Python Client

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

3 stars

Watchers

4 watching

Forks

6 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.