PrimeHub SDK/CLI Tools


PrimeHub Python SDK is the PrimeHub AI Platform Software Development Kit (SDK) for Python, allowing Python developers to write software that uses services like Job and Deployment.


Assuming that you have Python, you can install the library using pip:

$ pip install primehub-python-sdk

Or try the latest from our source code:

$ pip install git+

End-to-end Step

Step 1: Initial the PrimeHub CLI/SDK

PRIMEHUB_CLUSTER = <PrimeHub-cluster-url>

import os
from primehub import PrimeHub, PrimeHubConfig
ph = PrimeHub(PrimeHubConfig())


Step 2: Get the authorization code

If you see the content that want us to insert the authorization code, please click the url to get the token.

Step 3: Check the group information

if ph.is_ready():
    print("PrimeHub Python SDK setup successfully")
    print("Current Group:", ph.primehub_config.current_group)
    print("PrimeHub Python SDK couldn't get the group information, please check the configuration.")
Current Group: {'id': <group-id>, 'name': 'InfuseAI', 'displayName': 'InfuseAI'}

Step 4: Use Primehub python SDK to submit the PrimeHub job.

# Submit a job
config = {
    "instanceType": "cpu-1",
    "image": "base-notebook",
    "displayName": "PrimeHub SDK: Model Training",
    "command": "echo 'We can do the model training in PrimeHub Jobs.'",

short_job =

Step 5: Submit the job

Submit the job and check the logs.

# Wait the job to be done
print('[ Waiting ]')['id'])
print('[ Job Done ]')

# Get logs
logs =['id'])
print('[ Job Logs ]')
for l in logs:

You can use other python SDK methods to control the PrimeHub. This tool can help you build an automatic ML pipeline with CI/CD pipeline.


Last updated