Jarvislabs.ai

JLClient

Is a Python API for Interacting with Jarvislabs.ai for creating GPU/CPU-powered instances.

Steps to get started

  1. Install JLclient
  2. Generate API token
  3. Authentication
  4. Create an Instance object which will let you -
    • Launch GPU/CPU powered instance
    • Pause the instance
    • Resume
    • Destroy
  5. Use the User class to
    • get instances that are in running and paused state.

Installation

pip install git+https://github.com/jarvislabsai/jlclient.git

Generate API token

you can Generate API token from Jarvislabs.ai.

Imports and configure

from jlclient import jarvisclient
from jlclient.jarvisclient import *
jarvisclient.token = '**************************duWRbO68IiMTkQKWi48'

Managing GPU/CPU powered instances on Jarvislabs.ai

Create Instance

Attributes

ParameterTypeDescription/ValuesDefault Value
instance_typestrChoose between GPU or CPU.GPU
num_gpus / num_cpusintAccording to the instance_type, choose the number of GPUs or CPUs.1
gpu_typestrChoose from A100, A5000, A6000, RTX6000Ada, RTX5000.RTX5000
templatestrUse User.get_templates() in our JLclient to get all templates.pytorch
script_idstrIf you have a script you can pass it.None
is_reservedboolTrue refers to an on-demand instance. False refers to a spot instance.True
durationstrChoose hour, week, and month. The pricing changes based on the duration..hour
http_portsstrAs per your requirement, you can specify the ports.None
storageintChoose between 20GB to 2TB.20
# Launch CPU Instance
instance: Instance = Instance.create('CPU',
                            num_cpus=1,
                            storage=25,
                            name='cpu instance')

# Launch GPU Instance
instance: Instance = Instance.create('GPU',
                            gpu_type='RTX6000Ada',
                            num_gpus=1,
                            storage=50,
                            name='gpu instance')

This should return the Instance object.

you can access the below attributes using the Instance object.

  • gpu_type
  • num_gpus
  • num_cpus
  • storage
  • name
  • machine_id
  • script_id
  • is_reserved
  • duration
  • script_args
  • http_ports
  • template
  • url
  • endpoints
  • ssh_str
  • status

Pause the instance

instance.pause()

You can call pause() on any Instance object.

Resume the instance

#Resuming with existing configuration
instance.resume()

#Modifying the parameters like scaling GPUs, switching GPU type, expanding storage, etc.
instance.resume(num_gpus=1,
                gpu_type='RTX5000',
                storage=100)

#Switching from GPU to CPU Instance
instance.resume(num_cpus=1,
                storage=25)

#Switching from CPU to GPU Instance
instance.resume(gpu_type='RTX6000Ada',
                num_gpus=1,
                storage=25)

You can modify an existing instance by changing the below resume parameters.

  • num_gpus

  • gpu_type

  • storage

or just call resume without any parameters to start the instance with the same configuration.

Destroy the instance

instance.destroy()

User management

The User class comes with the below key functionalities.

  • User.get_templates(): Returns the list of templates available.

  • User.get_instances(): Returns a list of Instance objects representing all the instances in your account.

  • User.get_balance(): Return the balance of the user.

Issues/Feature request

Do you like to see any new features, we are all ears. You can drop us an email at hello@jarvislabs.ai or chat with us for requesting any new features or reporting issues.

License

This project is licensed under the terms of the MIT license.

Previous
Data