GithubHelp home page GithubHelp logo

atom-101 / jlclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jarvislabsai/jlclient

0.0 0.0 0.0 62 KB

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

License: MIT License

Python 100.00%

jlclient's Introduction

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, RTX6000Ada, A5000, A6000, RTX5000. 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
# 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')

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.

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 [email protected] or chat with us for any new features or issues.

License

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

jlclient's People

Contributors

arunkumar-dhanraj avatar atom-101 avatar jarvislabsai avatar selvakumar-sss avatar svishnu88 avatar vishnumundlapudii avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.