Contents |
BOSS is a workflow orchestrator, a system that can be configured to automate your workflow requirements; it interacts with the OBS and with people and systems around it to apply your workflow steps. For more BOSS related general information, see Infrastructure/BOSS.
BOSS Launcher is the process starter in BOSS architecture. Launcher waits for an event and then start a process by sending the process definition to BOSS.
Launcher action is explained in three simple steps:
BOSS launchers are written in Python language (other bindings will be available later). Following code snippets are from the generic launcher template (see chapter Example Code). Launchers run continuously as daemons. It is convenient to write an init script to wrap and manage them.
You need to install two libraries:
* AIR: An RPC library used by BOSS * route-amqp-pyclient : The Python client library for Ruoute::AMQP
These libraries are open source and the code is published on gitorious :
* http://meego.gitorious.org/meego-infrastructure-tools/air * http://meego.gitorious.org/meego-infrastructure-tools/ruote-amqp-pyclient
They are also packaged for OpenSuse ( and Debian soon ) on OBS https://build.opensuse.org/project/show?project=Maemo%3AMeeGo-Infra
Once you have these libraries installed, you need to import them in your launcher like this :
from RuoteAMQP.launcher import Launcher
The parent class Launcher defined in launcher.py of the route-amqp-pyclient package takes care of most of the details needed to create a launcher. You just need to subclass it and use the "launch" member function.
For an explanation of processes check this page
This example shows a loop that runs every 10 seconds and checks if a certain condition is met it launches a process:
def mainLoop(self):
print "Template participant running"
while True:
# check condtion
if itHappened:
self.launch(process['definition'], process['fields'])
time.sleep(10)
To register your launcher you need to do the following :
l = templateLauncher(amqp_host=amqp_host, amqp_user=amqp_user, amqp_pass=amqp_pwd, amqp_vhost=amqp_vhost) l.mainLoop()
See following launcher template for example implementation with configuration, daemonization and packaging for Debian and opensuse look here : http://meego.gitorious.org/meego-infrastructure-tools/boss-launcher-template