Package: drekar-launch
Drekar Launchdrekar-launchis a simple tool to launch and manage multiple processes. It is based on the process management code
extracted from thepyri-coremodule, part of the PyRI Open-Source Teach Pendantdrekar-launchhas a similar goal toroslaunch, but
designed to be simpler and independent of ROS. It also has improvements in handling Windows process management
using Windows Job Objects. Yaml files are used to configure the processes to launch.drekar-launchwill show a minimal GUI windows when the--guiis specified. This window shows same basic
information, and has a "Stop All" button that will shut down all tasks. This GUI is useful ifdrekar-launchis
started interactively by the user rather than running as a background service.See alsodrekar-launch-process, a companion library that contains utility functions to use within processes
hosted bydrekar-launch. The functionswait_exit()andwait_exit_callback()assist in receiving shutdown
signals in a reliable cross-platform manner.Seedrekar-launch-process:https://github.com/johnwason/drekar-launch-processInstallationpython -m pip install --user drekar-launchOn Ubuntu, it may be necessary to replacepythonwithpython3.UsageYaml files are used to configure the processes to launch. The following is an example of adrekar-launch.yamlfile that launches two Python servers.name:example_http_serverstasks:-name:http_server_1program:python.exeargs:example_http_server.py 8100 Server1cwd:.-name:http_server_2program:python.exeargs:-example_http_server.py-8101-Hello from Server2!start-delay:1Theexample_http_server.pyprogram usesdrekar-launch-processto wait for the shutdown signal.In this example, thenamefield is the name of the launch group. Thetaskssection contains a list of tasks to
launch. The following fields are used to configure the launch of each task:name: The name of the processprogram: The program to executeargs: The command line arguments to pass toprogramcwd(optional): The working directory to run the program. Defaults to current directory.start-delay(optional): Delay the start of the program by specified secondsrestart(optional): If true, process will be restarted if it exitsrestart-backoff(optional): Delay in seconds before restarting after exitquit-on-terminate(optional): Iftrue, all processes will exit if the process exitstags(optional): Unusedenvironment(optional): Key/value pairs to add to environmentenv-file(optional): File of environmental variable to override the environmentdrekar-launchby default will loaddrekar-launch.yamlin the current directory. To run with default settings,
simply calldrekar-launch.drekar-launchIn some cases, it may be necessary to usepythonto launch. Thedrekar-launchexecutable may not be installed
toPATH.python -m drekar_launchdrekar-launchaccepts the following optional command line arguments:--config=: Specify an alternative configuration file--config-js=: Specify an alternative configuration file that uses Jinja2 templates--cwd=: Set the default working directory for processes--name=: Override the name of the launch group--quiet: Flag to suppress outputting to the terminal--gui: Show a simple GUI to stop the tasksDrekar Launch saves the output to log files located in the following locations:Windows:%LOCALAPPDATA%\drekar-launch\drekar-launch\LogsLinux:$HOME/.cache/SuperApp/logMac OS:$HOME//Library/Logs/drekar-launchLogs should be periodically cleaned if too much disk space is used.TODO: Add automatic log cleaning.Jinja2 Templates can be used to generate configurations that fill in values at runtime or even include other
templates. See the Jinja2 documentation (https://jinja.palletsprojects.com/) for more information on using templates.Four variables are available in the template:configpath: Absolute path to the configuration fileconfigdir: Directory containing the configuration fileenv: Environmental variablesplatform: Current platform of the system as returned bysys.platform. Typicallywin32,linux, ordarwin(Mac OS)vars: Extra variables passed on the command line. Use--var-name=value, wherenameandvalueare replaced with specific values.For example, ifCONDA_PREFIXneeds to be used:name:example_http_serverstasks:-name:http_server_1program:{{env["CONDA_PREFIX"]}}/python.exeargs:{{configdir}}/example_http_server.py 8100 Server1cwd:{{env["CONDA_PREFIX"]}}LicenseApache 2.0