Python Resource Allocation API
Project description
Python Configuration Registry API
=================================
Purpose
-------
The objective of this module is to provide a common API to the configuration
registy used to store service instance properties using KeyValue stores
like consul, etcd or zookeeper.
Usage examples
--------------
Basic usage examples::
import registry
registry.connect()
instance = registry.get_cluster_instance(user='jlopez', framework='cdh', flavour='5.7.0', id='1')
# Alternatively you can retrieve it by DN
instance = registry.get_cluster_instance(dn='jlopez/cdh/5.7.0/1')
nodes = instance.nodes
services = instance.services
for node in nodes:
print node.status
(user, framework, flavour, instance_id) = registry.register(user='jlopez', framework='cdh', flavour='5.7.0', nodes=nodes, services=services)
nodes = {
'master0': {
'name': 'master0.local', # docker name
'id': '', # docker id
'status': 'pending',
'cpu': '1',
'mem': '2048',
'disks': {
'type': 'ssd',
'number': 1,
'disk1': '/data/1',
},
'networks': {
'eth0': '10.117.253.101',
'eth1': '10.112.253.101',
},
'host': '', # docker engine
'services': ['service0', 'service1'],
},
'slave0': {
'name': 'slave0.local', # docker name
'id': '', # docker id
'status': 'pending',
'cpu': '1',
'mem': '2048',
'disks': {
'type': 'sata',
'number': 2,
'disk1': '/data/1',
'disk2': '/data/2',
},
'networks': {
'eth0': '10.117.253.101',
'eth1': '10.112.253.101',
},
'host': '', # docker engine
'services': ['service2'],
},
}
services = {
'service0': {
'status': 'pending',
'nodes': ['master0'],
'property1': '2048',
'property2': '11',
},
'service1': {
'status': 'running',
'nodes': ['slave0'],
'property1': '2048',
'property2': '11',
},
}
framework = {
'executor': 'docker-executor',
'image': 'gluster:2.7.0',
'management_script': 'http://.../manage_gluster_cluster.py'
}
{'master0': {'cpu': '1',
'disks': {'disk1': '/data/1', 'number': 1, 'type': 'ssd'},
'host': '',
'id': '',
'mem': '2048',
'name': 'master0.local',
'networks': {'eth0': '10.117.253.101', 'eth1': '10.112.253.101'},
'services': ['service0', 'service1'],
'status': 'pending'},
'slave0': {'cpu': '1',
'disks': {'disk1': '/data/1',
'disk2': '/data/2',
'number': 2,
'type': 'sata',
'volumes': {'disk1': {'destination': '/data/1',
'mode': 'rw',
'origin': '/data/1/instances-jlopez-template-0.1.0-2'},
'disk2': {'destination': '/data/2', 'mode': 'rw', 'origin': '/data/2'}}},
'host': '',
'id': '',
'mem': '2048',
'name': 'slave0.local',
'networks': {'eth0': '10.117.253.101', 'eth1': '10.112.253.101'},
'services': ['service2'],
'status': 'pending'}}
=================================
Purpose
-------
The objective of this module is to provide a common API to the configuration
registy used to store service instance properties using KeyValue stores
like consul, etcd or zookeeper.
Usage examples
--------------
Basic usage examples::
import registry
registry.connect()
instance = registry.get_cluster_instance(user='jlopez', framework='cdh', flavour='5.7.0', id='1')
# Alternatively you can retrieve it by DN
instance = registry.get_cluster_instance(dn='jlopez/cdh/5.7.0/1')
nodes = instance.nodes
services = instance.services
for node in nodes:
print node.status
(user, framework, flavour, instance_id) = registry.register(user='jlopez', framework='cdh', flavour='5.7.0', nodes=nodes, services=services)
nodes = {
'master0': {
'name': 'master0.local', # docker name
'id': '', # docker id
'status': 'pending',
'cpu': '1',
'mem': '2048',
'disks': {
'type': 'ssd',
'number': 1,
'disk1': '/data/1',
},
'networks': {
'eth0': '10.117.253.101',
'eth1': '10.112.253.101',
},
'host': '', # docker engine
'services': ['service0', 'service1'],
},
'slave0': {
'name': 'slave0.local', # docker name
'id': '', # docker id
'status': 'pending',
'cpu': '1',
'mem': '2048',
'disks': {
'type': 'sata',
'number': 2,
'disk1': '/data/1',
'disk2': '/data/2',
},
'networks': {
'eth0': '10.117.253.101',
'eth1': '10.112.253.101',
},
'host': '', # docker engine
'services': ['service2'],
},
}
services = {
'service0': {
'status': 'pending',
'nodes': ['master0'],
'property1': '2048',
'property2': '11',
},
'service1': {
'status': 'running',
'nodes': ['slave0'],
'property1': '2048',
'property2': '11',
},
}
framework = {
'executor': 'docker-executor',
'image': 'gluster:2.7.0',
'management_script': 'http://.../manage_gluster_cluster.py'
}
{'master0': {'cpu': '1',
'disks': {'disk1': '/data/1', 'number': 1, 'type': 'ssd'},
'host': '',
'id': '',
'mem': '2048',
'name': 'master0.local',
'networks': {'eth0': '10.117.253.101', 'eth1': '10.112.253.101'},
'services': ['service0', 'service1'],
'status': 'pending'},
'slave0': {'cpu': '1',
'disks': {'disk1': '/data/1',
'disk2': '/data/2',
'number': 2,
'type': 'sata',
'volumes': {'disk1': {'destination': '/data/1',
'mode': 'rw',
'origin': '/data/1/instances-jlopez-template-0.1.0-2'},
'disk2': {'destination': '/data/2', 'mode': 'rw', 'origin': '/data/2'}}},
'host': '',
'id': '',
'mem': '2048',
'name': 'slave0.local',
'networks': {'eth0': '10.117.253.101', 'eth1': '10.112.253.101'},
'services': ['service2'],
'status': 'pending'}}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file configuration-registry-0.1.1.tar.gz.
File metadata
- Download URL: configuration-registry-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
804866965de4b73c76577730f015a89207c0820e6948bc07506bff69004074a6
|
|
| MD5 |
a6f23bf283eb1d9ac52826cb21f5630c
|
|
| BLAKE2b-256 |
52b1f020f68ea6ac4d08809cda1d084c957e1231fdd89cae1a186f187dc1dd12
|