Meego Wiki
Views

Release Infrastructure/BOSS Launcher

From MeeGo wiki
< Release Infrastructure(Difference between revisions)
Jump to: navigation, search
(Class definition)
m
 
Line 1: Line 1:
-
== BOSS Launcher ==
+
== BOSS ==
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 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]].

Latest revision as of 14:37, 6 October 2010

Contents

BOSS

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.


What is BOSS Launcher

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:

  • Receive any arbitrary event.
  • Process the event and extract needed information from it.
  • Select and or launch a process along with the associated work item.


Launcher Coding Guidelines

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.

Prerequisites

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

Import

Once you have these libraries installed, you need to import them in your launcher like this :

from  RuoteAMQP.launcher import Launcher

Class definition

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

process['definition'] = """
Ruote.process_definition :name => 'notification' do
  sequence do
    notify
  end        
end
"""

process['fields'] = {'msg' : 'Template', 'result' : 'Result'}

This example shows a loop that runs every 10 seconds and checks if a certain condition is met it launches the process defined above:

def mainLoop(self):
  print "Template participant running"
  while True:
     # check condtion
    if itHappened:
        self.launch(process['definition'], process['fields'])
    time.sleep(10)

Registering BOSS Launcher to server

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()

Launcher Example Code

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

Personal tools