NVIDIA GPU Cloud SDK
Project description
NGC-SDK
The NVIDIA NGC software development kit to interact and develop Python utilities and applications to integrate with the NVIDIA GPU Cloud.
Prerequisites
Python version >= 3.9
Install from pypi
Install the package from pypi.org by running the following command:
pip install ngcsdk
This project will download and install additional third-party open source software projects. Review the license terms of these open source projects before use.
After installing the SDK, the first step is to create and configure the client.
Creating and configuring NGC SDK client
To set the configuration, run the following functions.
Tip
This needs an API key. For information about generating an API key, refer to the setup, https://ngc.nvidia.com/setup.
from ngcsdk import Client
clt = Client()
clt.configure(api_key='****NkMQ', org_name='nvidia', team_name='no-team', ace_name='no-ace')
Validating configuration...
Successfully validated configuration.
clt.current_config()
[{'key': 'apikey', 'value': '****NkMQ', 'source': 'user settings'},
{'key': 'format_type', 'value': 'ascii', 'source': 'user settings'},
{'key': 'org', 'value': 'nvidia', 'source': 'user settings'},
{'key': 'team', 'value': 'no-team', 'source': 'user settings'},
{'key': 'ace', 'value': 'no-ace', 'source': 'user settings'}]
Debugging
Configure debug logging using Python's logging utility.
import logging
from ngcsdk import Client
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
clt = Client()
ace = clt.basecommand.aces.info("nv-us-west-2")
DEBUG:ngcbpc.api.connection:Requesting URL (GET): https://api.stg.ngc.nvidia.com/v2/org/nvidia/aces/ceph-sjc-4-dev
payload: None
params: None
DEBUG:ngcbpc.api.authentication:Retrieving API Key Token from cache....
DEBUG:ngcbpc.api.authentication:Token in use: ****hPWE
DEBUG:ngcbpc.api.authentication:Expiration time of token: '2024-03-07 16:36:03.849188'
DEBUG:ngcbpc.api.authentication:Fetched token from the cache. Expires 2024-03-07 16:36:03.849188
DEBUG:ngcbpc.api.utils:Headers:
DEBUG:ngcbpc.api.utils:{'Content-Type': 'application/json', ...}
DEBUG:ngcbpc.api.connection:Response status: 200 - Reason: OK
DEBUG:ngcbpc.api.connection:Time taken to process URL: https://api.stg.ngc.nvidia.com/v2/org/nvidia/aces/ceph-sjc-4-dev: 0.34587s
DEBUG:ngcbpc.api.connection:Response is: {"requestStatus":{"statusCode":"SUCCESS"}, ...}
For more information on how to configure logging, see Python's official tutorial on logging.
Output
Methods return either objects or JSON. Objects can be inspected and converted to a python dictionary or JSON format.
from ngcsdk import Client
clt = Client()
ace = clt.basecommand.aces.info("nv-us-west-2")
help(ace)
Help on Ace in module ngccli.data.api.Ace object:
class Ace(builtins.object)
| Ace(propDict=None)
|
| ACE is a collection of nodes that can run jobs
|
| Methods defined here:
|
| __init__(self, propDict=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| isValid(self)
|
| toDict(self)
|
| toJSON(self, pretty=False)
ace.toDict()
{'allowExposedPort': False, ...}
ace.toJSON()
'{"allowExposedPort": false, ...}
aces = clt.basecommand.aces.list()
help(aces)
Help on chain object:
class chain(builtins.object)
| chain(*iterables) --> chain object
|
| Return a chain object whose .__next__() method returns elements from the
| first iterable until it is exhausted, then elements from the next
| iterable, until all of the iterables are exhausted.
|
| Methods defined here:
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __iter__(self, /)
| Implement iter(self).
|
| __next__(self, /)
| Implement next(self).
[ace.name for ace in aces]
['ac-auth-debug-ace', ....]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file ngcsdk-3.43.0-py3-none-any.whl
.
File metadata
- Download URL: ngcsdk-3.43.0-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fd4dfdc072569228dffb4552e91b755dd1f56a1ecaa9700bc2332d3d39d8747 |
|
MD5 | be28dc8035d10d7bb21f8ef07366de04 |
|
BLAKE2b-256 | 60444e6c1d13298d53f8369a49211244fad4a7c1181bcce7ddc497b8473ca9ae |