Commit 93772488 authored by Felix Delattre's avatar Felix Delattre
Browse files

Renamed the_engine to rabotnik

parent 0b28f702
Pipeline #17999 passed with stage
in 24 seconds
......@@ -5,10 +5,10 @@ RABBITMQ_USER=test
RABBITMQ_PASSWORD=test
# Host url for messaging bus
THE_ENGINE_MESSAGE_BUS_HOST=the-engine-message-bus
RABOTNIK_MESSAGE_BUS_HOST=rabotnik-message-bus
# Host port for messaging bus
THE_ENGINE_MESSAGE_BUS_PORT=5672
RABOTNIK_MESSAGE_BUS_PORT=5672
# Send all unbuffered output
PYTHONUNBUFFERED=1
===============
the-engine demo
===============
=============
rabotnik demo
=============
Simplest showcase for
`the-engine <https://git.gfz-potsdam.de/dynamicexposure/the-engine/the-engine>`__
`rabotnik <https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rabotnik>`__
spinnig up two of its instances with example computation content and a
`main message bus <https://git.gfz-potsdam.de/dynamicexposure/server-components/containers/docker-the-engine-message-bus>`__
`main message bus <https://git.gfz-potsdam.de/dynamicexposure/rabotnik/docker-rabotnik-message-bus>`__
for the communication and triggering of actions between the instances.
The `data/instance-a/__main__.py` which send the signal `building` with a *building_id* to the
broker. The client `data/instance-b/__main__.py` reacts to that signal in its `building` method.
For testing use the rabbitmq broker provided by the engine in the `tests/rabbitmq-docker`
For testing use the rabbitmq broker provided by the rabotnik in the `tests/rabbitmq-docker`
directory which comes preconfigured within a `docker-compose` environment.
The whole setup can be started with docker-compose:
......
......@@ -20,18 +20,18 @@ import logging
import sys
# pylint: disable=import-error
from the_engine import TheEngine
from rabotnik import Rabotnik
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
# Initiate the engine
the_engine = TheEngine("instance-a")
# Initiate the rabotnik
rabotnik = Rabotnik("instance-a")
logger.info("running: instance a")
# Trigger a very simple 'building' task
the_engine.processor.send_task("building", kwargs=dict(building_id=21))
rabotnik.processor.send_task("building", kwargs=dict(building_id=21))
# Celery needs an exposed "app"
app = the_engine.processor
app = rabotnik.processor
......@@ -20,7 +20,7 @@ import logging
import sys
# pylint: disable=import-error
from the_engine import TheEngine, Task
from rabotnik import Rabotnik, Task
table_name = "test_table"
......@@ -28,11 +28,11 @@ logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
the_engine = TheEngine("instance-b", "mockeddb")
rabotnik = Rabotnik("instance-b", "mockeddb")
logger.info("running: instance b")
@the_engine.processor.task(name="building")
@rabotnik.processor.task(name="building")
def building(building_id):
"""React on building signal.
......@@ -45,17 +45,17 @@ def building(building_id):
# data returned by a database query.
# A new celery task could be spawned for that:
recalculate_building_foo.apply_async(kwargs=dict(building_id=building_id))
recalculate_building_demo.apply_async(kwargs=dict(building_id=building_id))
@the_engine.processor.task(name="recalculate_building_foo", base=Task)
def recalculate_building_foo(building_id):
@rabotnik.processor.task(name="recalculate_building_demo", base=Task)
def recalculate_building_demo(building_id):
"""A database task has access to the local database instance."""
db = recalculate_building_foo.database
db = recalculate_building_demo.database
for row in db.get_results("select * from %s" % table_name):
logger.info("data: %s" % str(row))
# Celery needs an exposed "app"
app = the_engine.processor
app = rabotnik.processor
......@@ -17,20 +17,20 @@
version: '3'
services:
# the-engine main message bus based on rabbitmq
the-engine-message-bus:
build: ../docker-the-engine-message-bus
# rabotnik main message bus based on rabbitmq
rabotnik-message-bus:
build: ../docker-rabotnik-message-bus
# the-engine instance a
the-engine-instance-a:
build: ../docker-the-engine-instance
# rabotnik instance a
rabotnik-instance-a:
build: ../docker-rabotnik-instance
depends_on:
- the-engine-instance-b
- rabotnik-instance-b
volumes:
- ../the-engine:/srv/the-engine
- ../rabotnik:/srv/rabotnik
# the-engine instance b
the-engine-instance-b:
build: ../docker-the-engine-instance
# rabotnik instance b
rabotnik-instance-b:
build: ../docker-rabotnik-instance
volumes:
- ../the-engine:/srv/the-engine
- ../rabotnik:/srv/rabotnik
......@@ -17,9 +17,9 @@
version: '3'
services:
# the-engine main message bus based on rabbitmq
the-engine-message-bus:
build: https://git.gfz-potsdam.de/dynamicexposure/the-engine/docker-the-engine-message-bus.git
# rabotnik main message bus based on rabbitmq
rabotnik-message-bus:
build: https://git.gfz-potsdam.de/dynamicexposure/rabotnik/docker-rabotnik-message-bus.git
env_file: .env
ports:
- "1883:1883" # mqtt port
......@@ -27,20 +27,20 @@ services:
- "15672:15672" # management
- "15692:15692"
# the-engine instance a
the-engine-instance-a:
# rabotnik instance a
rabotnik-instance-a:
env_file: .env
build: https://git.gfz-potsdam.de/dynamicexposure/the-engine/docker-the-engine-instance.git
build: https://git.gfz-potsdam.de/dynamicexposure/rabotnik/docker-rabotnik-instance.git
depends_on:
- the-engine-message-bus
- rabotnik-message-bus
volumes:
- ./data/instance-a:/srv/the-engine-instance
- ./data/instance-a:/srv/rabotnik-instance
# the-engine instance b
the-engine-instance-b:
# rabotnik instance b
rabotnik-instance-b:
env_file: .env
build: https://git.gfz-potsdam.de/dynamicexposure/the-engine/docker-the-engine-instance.git
build: https://git.gfz-potsdam.de/dynamicexposure/rabotnik/docker-rabotnik-instance.git
depends_on:
- the-engine-message-bus
- rabotnik-message-bus
volumes:
- ./data/instance-b:/srv/the-engine-instance
- ./data/instance-b:/srv/rabotnik-instance
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment