Lunch¶
Lunch is a distributed process starter and manager. It works on GNU/Linux and other operating systems which provide Python, bash, SSH and Twisted. For instance, it works on Mac OS X.- 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¶
See the Downloads page for tarball archives to download.
Get the Latest Version¶
If you are running Ubuntu GNU/Linux, the latest package for Ubuntu Lucid can be found in the Metalab archive. See https://launchpad.net/~sat-metalab/+archive/metalab
To quickly install lunch on Ubuntu Lucid:
sudo add-apt-repository ppa:sat-metalab/metalab sudo apt-get update sudo apt-get install lunch
If you run an other operating system, download the latest tarball archive and follow the instructions in the INSTALL file. We use the Python module setuptools (distutils) for the packaging.
The 0.3 branch has an unstable API, but contains many bugfixes and new features. Please read the list of deprecated arguments for the add_command function. They are listed at the end of this page.
Older versions¶
For production use, one can use the latest release in the 0.2 branch.
The first release of the 0.4 stable branch should be ready for June 30th, 2010. Again, see the Downloads page for the tarballs archives.
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:
python─┬─python───xeyes
└─ssh───python───xeyes
How-to¶
Installation¶
On Ubuntu GNU/Linux, you should use the 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 out¶
Copy 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
When the "-g" option is provided, you should see Lunch's window:
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¶
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. | |||||
| ssh_port | None | int | Specifies the SSH port to use when using a remote host. |
See the Deprecated page for options to avoid with this function.