RETIRED, First App Application for OpenStack
Go to file
Christian Berendt eb5f34f7ca A basic support to run services in the background 2015-02-15 19:02:47 +01:00
ansible A basic support to run services in the background 2015-02-15 19:02:47 +01:00
images Add a basic worker to generate Julia set fractal images 2015-02-12 09:51:14 +01:00
openstack_application_tutorial A basic support to run services in the background 2015-02-15 19:02:47 +01:00
.gitignore A basic support to run services in the background 2015-02-15 19:02:47 +01:00
LICENSE Initial commit 2015-02-11 19:54:02 +01:00
README.rst Make tracker/worker/producer installable 2015-02-15 17:48:58 +01:00
Vagrantfile Make tracker/worker/producer installable 2015-02-15 17:48:58 +01:00
requirements.txt A basic support to run services in the background 2015-02-15 19:02:47 +01:00
setup.cfg Make tracker/worker/producer installable 2015-02-15 17:48:58 +01:00
setup.py Make tracker/worker/producer installable 2015-02-15 17:48:58 +01:00
test-requirements.txt Make tracker/worker/producer installable 2015-02-15 17:48:58 +01:00
tox.ini Make tracker/worker/producer installable 2015-02-15 17:48:58 +01:00

README.rst

Openstack tutorial application

Workflow

image

  • The producer generates a random number of tasks with random parameters and a UUID as identifier.
  • The producer pushes the generated tasks into the exchange tasks.
  • The producer inserts a new record for each task into the database (including all parameters and the UUID).
  • The producer sleeps for a random number of seconds and will generate more tasks after awakening.
  • All messages in the tasks exchange will be routed into the tasks queue.
  • The worker waits for new messages in the tasks queue.
  • After receiving a message the worker generates an image based on the received parameters and writes the result into a local file (identified by the UUID).
  • After writing an image the worker pushes the result (the checksum of the generated image and the duration identified by the UUID) into the exchange results.
  • All messages in the results exchange will be routed into the results queue.
  • The tracker waits for new messages in the results queue.
  • After receiving a message the tracker updates the duration and checksum value of the corresponding database record (identified by the UUID).

Frameworks

Example image

image

Vagrant environment

The installation of Vagrant is described at https://docs.vagrantup.com/v2/installation/index.html.

$ vagrant up

Login with vagrant ssh, change into the directory /vagrant and open a new screen or tmux session. Aftwards run the worker, producer, and tracker services in the foreground, each service in a separate window.

$ python openstack_application_tutorial/worker.py
$ python openstack_application_tutorial/tracker.py
$ python openstack_application_tutorial/producer.py

RabbitMQ server

The webinterface of the RabbitMQ server is reachable on TCP port 15672. The login is possible with the user guest and the password secretsecret.

MySQL server

The password of the user root is secretsecret. The password of the user tutorial for the database tutorial is also secretsecret.

Example outputs

Producer service

2015-02-12 22:21:42,870 generating 2 task(s)
2015-02-12 22:21:42,876 generated task: {'width': 728, 'yb': 2.6351683415972076, 'uuid': UUID('66d5f67e-d26d-42fb-9d88-3c3830b4187a'), 'iterations': 395, 'xb': 1.6486035545865234, 'xa': -1.2576814065507933, 'ya': -2.8587178863035616, 'height': 876}
2015-02-12 22:21:42,897 generated task: {'width': 944, 'yb': 2.981696583462036, 'uuid': UUID('6f873111-8bc2-4d73-9a36-ed49915699c8'), 'iterations': 201, 'xb': 3.530775320058914, 'xa': -3.3511031734533794, 'ya': -0.921920674639712, 'height': 962}
2015-02-12 22:21:42,927 sleeping for 2.680171 seconds

Tracker service

2015-02-12 22:20:26,630 processing result be42a131-e4aa-4db5-80d1-1956784f4b81
2015-02-12 22:20:26,630 elapsed time 5.749099 seconds
2015-02-12 22:20:26,631 checksum 7ba5bf955a94f1aa02e5f442869b8db88a5915b7c2fb91ffba74708b8d799c2a

Worker service

2015-02-12 22:20:59,258 processing task 20a00e9e-baec-4045-bc57-2cb9d8d1aa61
2015-02-12 22:21:01,506 task 20a00e9e-baec-4045-bc57-2cb9d8d1aa61 processed in 2.246601 seconds
2015-02-12 22:21:01,553 saved result of task 20a00e9e-baec-4045-bc57-2cb9d8d1aa61 to file /home/vagrant/20a00e9e-baec-4045-bc57-2cb9d8d1aa61.png
2015-02-12 22:21:01,554 pushed result: {'duration': 2.246600866317749, 'checksum': 'faa0f00a72fac53e02c3eb392c5da8365139e509899e269227e5c27047af6c1f', 'uuid': UUID('20a00e9e-baec-4045-bc57-2cb9d8d1aa61')}

References