« Previous -
Version 63/80
(diff) -
Next » -
Current version
Alexandre Quessy, 2010-07-15 15:00
= Lunch =
{{{
#!html
}}}
Lunch is a distributed process starter and manager for GNU/Linux. It might also work under other operating systems which provide the python and bash interpreters. (it works on Mac OS X) A SSH client and server need to be installed as well.
* If you need to use it to start process on more than one computer, 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 stable version: (recommended)
* http://svn.sat.qc.ca/trac/lunch/raw-attachment/wiki/WikiStart/lunch_0.2.20-0ubuntu1_all.deb
Since version 0.2.17, the 0.2 branch is considered stable. It should be fully backward-compatible with lunch-slave version 0.2.12 and up.
'''New since 0.2.12''': the "depends" keyword argument. See the examples/dependencies.lunch example.
The changelog is in the file https://svn.sat.qc.ca/trac/lunch/browser/debian/changelog
= 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.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 =
Installation
On Ubuntu GNU/Linux, you should use the Debian package. Simply download it and Gdebi should ask you if you want to install it.
If you are using an other system, (like Mac OS X) you might need to do it the hard way. See the InstallationHowTo page to learn how.
Try it outCopy the "simple.lunch" example config file to the local ~/.lunchrc. Edit the configuration file to suit your needs. {{{
cp doc/examples/simple.lunch ~/.lunchrc
edit ~/.lunchrc
}}}
Start the lunch master:: {{{
lunch -g
}}}
There is also an icon
How to customize your lunch file
The ~/.lunchrc file is written in Python programming language. You only need to call a few functions, such as the add_command() function. Here are some examples:: {{{
add_command(command="xlogo", env={}, identifier="xlogo")
add_command(command="mplayer /usr/share/example-content/Ubuntu_Free_Culture_Showcase/StopMotionUbuntu.ogv", env={}, identifier="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", identifier="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", identifier="miville un", sleep_after=1)
add_command("/home/aalex/src/miville/branches/services/py/mivilled -o 1", identifier="miville deux", sleep_after=1)
add_command("xterm -c telnet localhost 14444", identifier="miville un")
add_command("xterm -c telnet localhost 14445", identifier="miville deux")
}}}
The Python documentation is at http://docs.python.org/
You might like to have a look at the PythonTricks page.
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. The only mandatory argument, and the first positional argument. | |||||
| identifier | 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 identifiers of processes on which this one depends. |
Here is the list of deprecated keyword arguments to avoid:
| '''Keyword''' | '''Default value''' | '''Python Type''' | '''Note''' | |||||
| title | None | str | DEPRECATED in version 0.3 ! Use identifier instead. | |||||
| 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. |