bitdeer-ai


Namebitdeer-ai JSON
Version 0.0.3 PyPI version JSON
download
home_pageNone
SummaryBitdeer AI Cloud SDK for Python.
upload_time2024-10-07 05:04:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords ai bitdeer cloud sdk training
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bitdeer AI Cloud Python SDK

[![PyPI - Version](https://img.shields.io/pypi/v/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)
[![PyPI - License](https://img.shields.io/pypi/l/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/Bitdeer_AI)](https://x.com/Bitdeer_AI)

-----

# Overview
The Bitdeer AI Cloud Python SDK provides a simple and efficient interface for managing cloud resources and services, like training jobs. It allows users to create, list, get details, and manage training jobs with ease. This SDK communicates with the server using gRPC and provides a range of functionalities for handling training jobs, including creation, retrieval, listing, deletion, suspension, and resumption.

# Installation
To install the Bitdeer AI Cloud Python SDK, you can use pip:

```
pip install bitdeer-ai
```

# Usage of Training Service
## Initialization
To interact with training service, you need to initialize the TrainingClient object with the host address of target host and an API Key for authentication.

```python
from bitdeer_ai.training.client import TrainingClient

# Initialize the client
client = TrainingClient(host='api.bitdeer.ai:443', token='API-KEY')
```

## Creating a Training Job
To create a training job, use the `create_training_job` method. You need to provide various parameters such as project_id, job_name, job_type, worker_spec, num_workers, and optional parameters like worker_image, working_dir, volume_name, volume_mount_path etc.

```python
from training.training_pb2 import JobType

job = client.create_training_job(
    project_id='your_project_id',
    region_id='your_region_id',
    zone_id='your_zone_id',
    job_name='example_job',
    job_type='your_job_type',
    worker_spec='spec_of_worker',
    num_workers=2,
    worker_image='worker_image_url',
    working_dir='/path/to/working/dir',
    volume_name='volume_name',
    volume_mount_path='/mount/path'
)
print(f'Training job created with ID: {job.training_job_id}')
```

## Retrieving a Training Job
To retrieve details of a specific training job, use the `get_training_job` method with the training_job_id.

```python
job = client.get_training_job(training_job_id='your_training_job_id')
print(f'Job Name: {job.job_name}')
```

## Listing Training Jobs
To list all training jobs, use the `list_training_jobs` method.

```python
jobs = client.list_training_jobs()
for job in jobs.training_jobs:
    print(f'Job ID: {job.training_job_id}, Job Name: {job.job_name}')
```

## Deleting a Training Job
To delete a specific training job, use the `delete_training_job` method with the training_job_id.

```python
client.delete_training_job(training_job_id='your_training_job_id')
print('Training job deleted successfully.')
```

## Suspending a Training Job
To suspend an active training job, use the `suspend_training_job` method with the training_job_id.

```python
client.suspend_training_job(training_job_id='your_training_job_id')
print('Training job suspended successfully.')
```

## Resuming a Training Job
To resume a suspended training job, use the `resume_training_job` method with the training_job_id.

```python
client.resume_training_job(training_job_id='your_training_job_id')
print('Training job resumed successfully.')
```

## Getting Training Job Workers
To get details of workers associated with a specific training job, use the `get_training_job_workers` method with the training_job_id.

```python
workers = client.get_training_job_workers(training_job_id='your_training_job_id')
for worker in workers.workers:
    print(f'Worker Name: {worker.name}')
```

## Getting Training Job Logs
To stream logs of a specific training job, use the `get_training_job_logs` method with the training_job_id, worker_name, and follow flag.

```python
logs = client.get_training_job_logs(training_job_id='your_training_job_id', worker_name='worker_name', follow=True)
for log in logs:
    print(log)
```

## Error Handling
The SDK raises various exceptions to handle errors:

- RuntimeError: Raised when there is a failure in creating or deleting a training job.

Make sure to handle these exceptions in your code to ensure smooth operation.

```python
try:
    job = client.create_training_job(
        project_id='your_project_id',
        job_name='example_job',
        job_type='your_job_type',
        worker_spec='spec_of_worker',
        num_workers=2
    )
except RuntimeError as e:
    print(f'Runtime Error: {e}')
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "bitdeer-ai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Bitdeer <support@bitdeer.com>",
    "keywords": "ai, bitdeer, cloud, sdk, training",
    "author": null,
    "author_email": "Bitdeer <support@bitdeer.com>",
    "download_url": "https://files.pythonhosted.org/packages/c3/56/27bd88fbe3a27a78d6055f2e1d57490e34393d31112f410b92089bcfe483/bitdeer_ai-0.0.3.tar.gz",
    "platform": null,
    "description": "# Bitdeer AI Cloud Python SDK\n\n[![PyPI - Version](https://img.shields.io/pypi/v/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)\n[![PyPI - License](https://img.shields.io/pypi/l/bitdeer-ai)](https://pypi.org/project/bitdeer-ai)\n[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/Bitdeer_AI)](https://x.com/Bitdeer_AI)\n\n-----\n\n# Overview\nThe Bitdeer AI Cloud Python SDK provides a simple and efficient interface for managing cloud resources and services, like training jobs. It allows users to create, list, get details, and manage training jobs with ease. This SDK communicates with the server using gRPC and provides a range of functionalities for handling training jobs, including creation, retrieval, listing, deletion, suspension, and resumption.\n\n# Installation\nTo install the Bitdeer AI Cloud Python SDK, you can use pip:\n\n```\npip install bitdeer-ai\n```\n\n# Usage of Training Service\n## Initialization\nTo interact with training service, you need to initialize the TrainingClient object with the host address of target host and an API Key for authentication.\n\n```python\nfrom bitdeer_ai.training.client import TrainingClient\n\n# Initialize the client\nclient = TrainingClient(host='api.bitdeer.ai:443', token='API-KEY')\n```\n\n## Creating a Training Job\nTo create a training job, use the `create_training_job` method. You need to provide various parameters such as project_id, job_name, job_type, worker_spec, num_workers, and optional parameters like worker_image, working_dir, volume_name, volume_mount_path etc.\n\n```python\nfrom training.training_pb2 import JobType\n\njob = client.create_training_job(\n    project_id='your_project_id',\n    region_id='your_region_id',\n    zone_id='your_zone_id',\n    job_name='example_job',\n    job_type='your_job_type',\n    worker_spec='spec_of_worker',\n    num_workers=2,\n    worker_image='worker_image_url',\n    working_dir='/path/to/working/dir',\n    volume_name='volume_name',\n    volume_mount_path='/mount/path'\n)\nprint(f'Training job created with ID: {job.training_job_id}')\n```\n\n## Retrieving a Training Job\nTo retrieve details of a specific training job, use the `get_training_job` method with the training_job_id.\n\n```python\njob = client.get_training_job(training_job_id='your_training_job_id')\nprint(f'Job Name: {job.job_name}')\n```\n\n## Listing Training Jobs\nTo list all training jobs, use the `list_training_jobs` method.\n\n```python\njobs = client.list_training_jobs()\nfor job in jobs.training_jobs:\n    print(f'Job ID: {job.training_job_id}, Job Name: {job.job_name}')\n```\n\n## Deleting a Training Job\nTo delete a specific training job, use the `delete_training_job` method with the training_job_id.\n\n```python\nclient.delete_training_job(training_job_id='your_training_job_id')\nprint('Training job deleted successfully.')\n```\n\n## Suspending a Training Job\nTo suspend an active training job, use the `suspend_training_job` method with the training_job_id.\n\n```python\nclient.suspend_training_job(training_job_id='your_training_job_id')\nprint('Training job suspended successfully.')\n```\n\n## Resuming a Training Job\nTo resume a suspended training job, use the `resume_training_job` method with the training_job_id.\n\n```python\nclient.resume_training_job(training_job_id='your_training_job_id')\nprint('Training job resumed successfully.')\n```\n\n## Getting Training Job Workers\nTo get details of workers associated with a specific training job, use the `get_training_job_workers` method with the training_job_id.\n\n```python\nworkers = client.get_training_job_workers(training_job_id='your_training_job_id')\nfor worker in workers.workers:\n    print(f'Worker Name: {worker.name}')\n```\n\n## Getting Training Job Logs\nTo stream logs of a specific training job, use the `get_training_job_logs` method with the training_job_id, worker_name, and follow flag.\n\n```python\nlogs = client.get_training_job_logs(training_job_id='your_training_job_id', worker_name='worker_name', follow=True)\nfor log in logs:\n    print(log)\n```\n\n## Error Handling\nThe SDK raises various exceptions to handle errors:\n\n- RuntimeError: Raised when there is a failure in creating or deleting a training job.\n\nMake sure to handle these exceptions in your code to ensure smooth operation.\n\n```python\ntry:\n    job = client.create_training_job(\n        project_id='your_project_id',\n        job_name='example_job',\n        job_type='your_job_type',\n        worker_spec='spec_of_worker',\n        num_workers=2\n    )\nexcept RuntimeError as e:\n    print(f'Runtime Error: {e}')\n```",
    "bugtrack_url": null,
    "license": null,
    "summary": "Bitdeer AI Cloud SDK for Python.",
    "version": "0.0.3",
    "project_urls": {
        "Documentation": "https://github.com/BitdeerAI/python-sdk#readme",
        "Homepage": "https://www.bitdeer.ai",
        "Issues": "https://github.com/BitdeerAI/python-sdk/issues",
        "Source": "https://github.com/BitdeerAI/python-sdk"
    },
    "split_keywords": [
        "ai",
        " bitdeer",
        " cloud",
        " sdk",
        " training"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a00a32970668389a2ee0453211fab465cd1a3dc2bfc954a0a196f9a02c9a0327",
                "md5": "e4df3047072c55d97cf0863991aa393d",
                "sha256": "96235103bf3345696e60e5a70d6b92f2dd1441b514a5e669ed790cff531d51e2"
            },
            "downloads": -1,
            "filename": "bitdeer_ai-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4df3047072c55d97cf0863991aa393d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12390,
            "upload_time": "2024-10-07T05:04:02",
            "upload_time_iso_8601": "2024-10-07T05:04:02.011407Z",
            "url": "https://files.pythonhosted.org/packages/a0/0a/32970668389a2ee0453211fab465cd1a3dc2bfc954a0a196f9a02c9a0327/bitdeer_ai-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c35627bd88fbe3a27a78d6055f2e1d57490e34393d31112f410b92089bcfe483",
                "md5": "4553de50f18ffed64bd6cd216098a4b5",
                "sha256": "e8b5a53c4e2b8d65cab0f0ee10a504c0547a65dd63d57803ba96515e4ca1a51d"
            },
            "downloads": -1,
            "filename": "bitdeer_ai-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4553de50f18ffed64bd6cd216098a4b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11581,
            "upload_time": "2024-10-07T05:04:00",
            "upload_time_iso_8601": "2024-10-07T05:04:00.508835Z",
            "url": "https://files.pythonhosted.org/packages/c3/56/27bd88fbe3a27a78d6055f2e1d57490e34393d31112f410b92089bcfe483/bitdeer_ai-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 05:04:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "BitdeerAI",
    "github_project": "python-sdk#readme",
    "github_not_found": true,
    "lcname": "bitdeer-ai"
}
        
Elapsed time: 0.46825s