Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JLclient

Interacting with Jarvislabs.ai for creating GPU/CPU powered instances on top of A100, A6000, RTX 5000 and RTX6000Ada.

Installation

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


Imports and configure

from jlclient import jarvisclient

from jlclient.jarvisclient import *



jarvisclient.token = '**************************duWRbO68IiMTkQKWi48'

Generate a token from here.

Managing GPU/CPU powered instances on Jarvislabs.ai

Create

Parameter Type Description/Values Default Value
instance_type str Choose between GPU or CPU. GPU
num_gpus / num_cpus int Choose between 1 to 8 for GPU instance. 1
gpu_type str Choose from A100, A100-80GB, RTX6000Ada, A5000, A6000, RTX5000, L4, H100, H200. RTX5000
template str Use User.get_templates() to get all templates. pytorch
script_id str Use User.get_scripts() to get all script ids and pass it. None
is_reserved bool True refers to an on-demand instance. False refers to a spot instance. True
duration str Choose hour, week, and month. The pricing changes based on the duration.. hour
http_ports str As per your requirement, you can specify the ports. None
storage int Choose between 20GB to 2TB. 20
region str Optional. Choose from india-01, india-noida-01, europe-01. auto-resolved
# CPU Instance Example

instance: Instance = Instance.create('CPU',
                            num_cpus=1,
                            storage=25,
                            template='pytorch',
                            name='cpu instance')


# GPU Instance Example

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


# Europe H200 Example

instance: Instance = Instance.create('GPU',
                            gpu_type='H200',
                            num_gpus=1,
                            storage=100,
                            template='pytorch',
                            region='europe-01',
                            name='europe h200 instance')

This should return the Instance object, which includes the following attributes

  • 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

If the Instance object isn't returned, an error dictionary will be provided.

If region is not passed, JLClient auto-resolves the best region from server metadata.

For europe-01, JLClient enforces:

  • GPU type must be H100 or H200
  • num_gpus must be 1 or 8
  • storage must be >= 100 GB

For template='vm', JLClient enforces:

  • only GPU instances (no CPU vm create)
  • GPU must be H100 or H200
  • region must be europe-01

For India/Noida regions, GPU availability is dynamic and region-specific. If a requested GPU is not available in that region at launch time, backend availability errors are returned to the client.

Note: Please contact us if you encounter any errors while launching the instance.

Pause

instance.pause()

Pause existing Instance

    # Get the running Instance
    instance: Instance = User.get_instance(instance_id=12345)

    instance.pause()

You can call pause() on any Instance object.

Resume

#Example 1:

instance.resume()



#Example 2:

instance.resume(num_gpus=1,
                gpu_type='RTX5000',
                storage=100)


#Switching GPU to CPU Instance, pass the num_cpus parameter

instance.resume(num_cpus=1,
                storage=25)

#Switching CPU to GPU Instance, pass the num_gpus & gpu_type

instance.resume(gpu_type='RTX6000Ada',
                num_gpus=1,
                storage=25)

Resume existing Instance

   # Get the paused Instance
   instance: Instance = User.get_instance(instance_id=12345)

   # Resuming the old instance
   new_instance = instance.resume()

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

  • num_gpus

  • gpu_type

  • storage

or just call resume to start with the same configuration.

Destroy

instance.destroy()

Destroy the existing Instance

    # Get the paused or running Instance
    instance: Instance = User.get_instance(instance_id=12345)

    instance.destroy()

Invoking the destroy method on any instance object will permanently delete the instance and it cannot be retrieve.

User management.

The User class comes with the below key functionalities.

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

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

  • User.get_instance() : Returns the Instance object.

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

  • User.get_scripts() : Return the list of scripts of the user

Get the scripts of the User

scripts = User.get_scripts()

'''

scripts = [{'script_id': 123, 'script_name': 'script1.sh'},
           {'script_id': 124, 'script_name': 'script2.sh'}]

'''

Invoking User.get_scripts() method to retrieve the scripts associated with the User.

Issues/Feature request

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

License

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

About

Interacting with Jarvislabs.ai for creating GPU/CPU powered instances on top of A100, A6000, RTX 5000.

Resources

Stars

17 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages