Code Monkey home page Code Monkey logo

clique-connector's Introduction

Clique Connector

Library that wraps a RabbitMQ connection and creates a channel between Clique agents and APIs.

Install

Locally

python setup.py install

Using Curdling

curd install [email protected]:bagis/clique-connector.git

Features

  • Send statistics
  • Listen for statistics
  • Ask for a virtual machine
  • Confirm a virtual machine job
  • Confirm with a virtual machine

How to test

  • Setup a RabbitMQ, preferably a docker container: docker run --name rabbitmq -p 25672:25672 -p 4369:4369 -p 5671-5672:5671-5672 rabbitmq
  • Then run all the tests: python setup.py test

How to use

from clique_connector import Connector

connector = Connector('127.0.0.1')

# Request a virtual machine
machine = await connector.create_machine(
    'some-random-machine', # Machine name
    'ubuntu-16.04', # Image name
    1, # CPU
    512, # Memory in MB
    128, # Disc in GB
    'your-public-ssh-key-as-string') # Public SSH key

# Response with a virtual machine
def callback(channel_close, name, cpu, mem, disc, pkey):
    return dict(host='127.0.0.1',
                username='root')

# Create listener
channel_close, observable = connector.wait_for_machines(callback)

# Start listening
machines = await observable \
    .take(3) # Create only three machines

# Clean up by closing channel
channel_close()

clique-connector's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.