« Previous - Version 52/80 (diff) - Next » - Current version
Alexandre Quessy, 2010-01-21 16:23


= Lunch = {{{
#!html
}}}
Lunch is a distributed process starter and manager for GNU/Linux. It might also work under other operating systems whhich provide the python and bash interpreters. A SSH client and server need to be installed as well. * The first step is to configure your SSH client. The steps to manage ssh keys are in the SshKeysManagement page. * Next, download and install lunch on every computer.

= Download =
Get the Latest Version
Here is a package of the latest development version: (recommended) * http://svn.sat.qc.ca/trac/lunch/raw-attachment/wiki/WikiStart/lunch_0.2.13-0ubuntu1_all.deb

'''New since 0.2.12''': the "depends" keyword argument. See the examples/dependencies.lunch example.

Older version

You can also try out the latest release of the 0.1 branch: (deprecated) * http://svn.sat.qc.ca/trac/lunch/raw-attachment/wiki/WikiStart/lunch_0.1.8_all.deb

If you had previously installed Lunch using the Makefile, you might need to do this : {{{
sudo rm -f /usr/local/bin/lunch
sudo rm -f /usr/local/share/man/man1/lunch.1
sudo rm -f /usr/local/share/applications/lunch.desktop
sudo rm -f /usr/local/share/applications/Lunch.desktop
sudo rm -f /usr/local/share/icons/lunch.svg
sudo rm -f /usr/local/share/icons/lunch.png
sudo rm -f /usr/local/share/pixmaps/lunch.png
}}}

= Learn More = * See the RoadMap to see what is coming. * Please add tickets to warn us about bugs and ask for features. * If you are curious, the ReleaseProcess page has details on how we package the application. * In a latter version, a UserInterface is planned. * See CopyrightInformations to learn that it is licensed under the GNU General Public License. * You can also add the new SoftwareSource to your APT sources list.

Here is a process tree created with lunch 0.1 : {{{
python─┬─python───sh───xterm───python───sh───xeyes
└─python───sh───ssh───xterm───python───sh───xeyes
}}}
Here is a process tree created with lunch 0.2 : {{{
python─┬─python───xeyes
└─ssh───python───xeyes
}}}
The first {{{ python }}} process in each tree in {{{ lunch }}} master, and the seconds are {{{ lunch-slave}}}. = How-to =
You should use the Debian packages to install it on Ubuntu. If you are using an other system, you might need to do it the hard way. See the InstallationHowTo page to learn how.

Try it out
Copy the "config-sample" example config file to the local ~/.lunchrc. Edit the configuration file to suit your needs. {{{
cp doc/examples/simple ~/.lunchrc
edit ~/.lunchrc
}}}
Start the lunch master:: {{{
lunch
}}} How to customize your lunch file
The ~/.lunchrc file is written in Python and the only function needed is add_command. Here are some examples:: {{{
add_command(command="xlogo", env={}, title="xlogo")
add_command(command="mplayer /usr/share/example-content/Ubuntu_Free_Culture_Showcase/StopMotionUbuntu.ogv", env={}, title="mplayer")
}}}
Setting the user and host arguments make it be issued through SSH to a remote host:: {{{
add_command(command="xlogo", env={"DISPLAY":":0.0"}, user="johndoe", host="example.org", title="remote_xlogo")
}}}
Here is a Lunch config file for miville. Note that the sleep attribute is for processes AFTER which we need to wait. {{{
add_command("/home/aalex/src/miville/branches/services/py/mivilled -o 0", title="miville un", sleep_after=1)
add_command("/home/aalex/src/miville/branches/services/py/mivilled -o 1", title="miville deux", sleep_after=1)
add_command("xterm -c telnet localhost 14444", title="miville un")
add_command("xterm -c telnet localhost 14445", title="miville deux")
}}}

You might like to have a look at the PythonTricks page.

The add_command function
The add_command function is the only thing you need to call from your Python script. You need to call it once for each child process to run, on either local or remote host. Here is a list of its keyword arguments and their default values.
'''Keyword''' '''Default value''' '''Python Type''' '''Note'''
command None str The bash command to run.
title None str Determines the name of the log files and the log keys.
env None dict A dict of name=value pairs of environment variables to set for the child process.
user None str The UNIX user name, when using SSH
host None str The IP address or host name to which connect using SSH. Lunch will not use SSH if not set.
sleep_after 0.25 float How long to wait before launching next command.
respawn True bool Should a child be respawned or not. Will only be run once if set to False.
minimum_lifetime_to_respawn 0.5 float Minimum life time a child must last in order to be respawned.
log_dir None str Specifies the logging directory for the lunch slave and child.
depends None str or list or str Specifies one or more title of processes on which this one depends.

Here is the list of deprecated keyword arguments to avoid:

'''Keyword''' '''Default value''' '''Python Type''' '''Note'''
log_file None str DEPRECATED in version 0.2
sleep None float DEPRECATED in version 0.2 ! Use sleep_after instead.
priority None int DEPRECATED in version 0.2 ! The order in which each command is added now determines the launching order.
order None int DEPRECATED in version 0.2 ! The order in which each command is added now determines the launching order.

Lunch200x200.png (24.7 kB) Simon Piette, 2010-01-04 19:57

snapshot_lunch_0.4_window.png (41.5 kB) Alexandre Quessy, 2011-03-26 18:07