Skip to main content

Create, use and destroy temporary slaves in the cloud

Project description

I have a number of different applications that need to fire up instances in the cloud to do various things. This module is supposed to be generically useful for that purpose.

What is it?

It’s an incredibly simple way to fire up instances in the cloud with very little effort. It fires up instances of a predefined flavor based on a predefined image.

What is it not?

A generic wrapper around the various OpenStack client libraries. It does one thing and does it well.

How to use it?

First, you configure a cloud:

>>> from cloudslave.models import Cloud
>>> cloud = Cloud(user_name='user_name',
                  tenant_name='tenant_name',
                  password='v3rysecret',
                  endpoint='http://auth/url/v2.0',
                  region='XX-YY', # <-- Optional
                  flavor_name = 'm1.small',
                  image_name = 'regex that matches the name of the image (first match will be used)')
>>> cloud.slave()

Then create a reservation:

>>> res = cloud.create_reservation(5)  # Starts 5 instances
>>> res.start()
>>> res.update_state()
1
>>> res.get_state_display()
'Booting'
>>> res.update_state()
2
>>> res.get_state_display()
'Ready'
>>> [slave.run_cmd('hostname').strip() for slave in res.slave_set.all()]
['cloudslave-nthdnsrn', 'cloudslave-blhhmncq', 'cloudslave-vygfls4t']

Lovely.

Once you’re done with them, terminate the reservation:

>>> res.terminate()

That’s it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-cloudslave-0.2.2.tar.gz (15.4 kB view details)

Uploaded Source

File details

Details for the file django-cloudslave-0.2.2.tar.gz.

File metadata

File hashes

Hashes for django-cloudslave-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e6c2bc004b9b6bfbcd53dbb7ab8f29aae952c4974972f08639569c7aa3fdbe9a
MD5 bb5bbb11f5d67f81bdcee0ed9f8f7677
BLAKE2b-256 c73cc80a0af540d40f6809f7be4971a5e851bcf79f86b851a8ad02828cbba548

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page