Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pAntler + GNU screen #2

Open
wants to merge 25 commits into
base: devel
Choose a base branch
from

Conversation

ianfixes
Copy link

Launch Processes in GNU Screen

This patch is a refactor of pAntler in order to add a new launch option: GNU screen (http://en.wikipedia.org/wiki/GNU_Screen).

The major benefit of launching screens is that unlike Newconsole = false (in which stdout/stderr text isn't visible) and Newconsole = true (in which the window with the program output is always visible), screen sessions provide a way to connect to a running process when needed, without putting xterms in your face.

Before

This is an example of a pAntler config block.

ProcessConfig = ANTLER
{
  Run = MOOSDB @ Newconsole=true, XConfig=blah ~ MOOSDB
  blah = -geometry,80x40+0+20
}

After

LaunchType replaces NewConsole (which is now the fallback option). LaunchType may be (case-insensitively) Process, Console, or Screen.

Here's the same block with the new configuration style.

ProcessConfig = ANTLER
{
  Run = MOOSDB @ LaunchType=Process, XConfig=blah ~ MOOSDB
  blah = -geometry,80x40+0+20
}

Better

Here's how to launch it in a screen. We're adding the ScreenConfig option -L which enables logging for the console output, but this is entirely unnecessary; it's here for demonstration.

ProcessConfig = ANTLER
{
  Run = MOOSDB @ LaunchType=Screen, ScreenConfig=blah ~ MOOSDB
  blah = -L
}

Running pAntler will launch this screen session. You can observe it by typing screen -ls in a terminal. You'll get something like the following:

$ screen -ls
There is a screen on:
    16833.MOOSDB    (10/28/2013 05:30:37 PM)    (Detached)
1 Socket in /var/run/screen/S-xxx.

And if you type screen -R MOOSDB, you can connect to it:

***************************************************
*       This is MOOS Server for Community "#1"
*       c. P Newman 2001
*
*       Binding on 9000
*
*       This machine is Little endian
***************************************************

------------CONNECT-------------
New client connected from machine "localhost"
Handshaking....done
clients name is "DBWebServer"
There are now 1 clients connected.
--------------------------------

*****************************************************
  serving webpages HTTP on http://xxxxx:9080
*****************************************************

Testing

A sample MOOS configuration file, test-antler-nix.moos, is provided to test each of the launch methods under *nix. Among various xmessage dialog boxes that will come up to indicate the launch parameters of each line, there will be a summary for the screen sessions that's displayed in an xterm. Output should be similar to the following:

There are screens on:
        8714.xmessage-newlaunch-screen  (11/01/2013 10:42:15 AM)        (Detached)
        8667.MOOSDB     (11/01/2013 10:42:09 AM)        (Detached)
2 Sockets in /var/run/screen/S-xxx.

This has been lightly tested in Ubuntu, but is untested in Win32. Presumed to work, because it's just using the old code in a new place. Please report back.

@tsaubergine
Copy link

I have done preliminary testing with this patch (on Ubuntu 12.04 LTS amd64) and this appears to be a useful feature.

-Toby

@tsaubergine
Copy link

I have found a bug with a previously working configuration file, that now breaks with this patch.

I have stripped out all the configuration except that line that makes it break. pAntler will launch "MOOSDB" and "uMS" with no parameters:

MOOSDB
uMS

whereas the expected behavior is to launch them with the typical MOOS parameters
MOOSDB last-small.moos MOOSDB
uMS last-small.moos uMS

last-small.moos:

ProcessConfig = pSomeApp
{
ADD_AUV=pose=[4x1]{100000,123000,-30,15},name = UNICORN,InputPrefix=,OutputPrefix=FRONTSEAT_
}

ProcessConfig = ANTLER
{
DebugLaunch = true
MSBetweenLaunches = 100
Run = MOOSDB @ NewConsole = false
Run = uMS @ NewConsole = false
}

MOOSValFromString(bNewConsole, sOption, "NEWCONSOLE",true);

//do we want to inhibit the passing of MOOS parameters (mission file and MOOSName)
bool bInhibitMOOSParams = false;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, here's the initialization that was removed.

@ianfixes
Copy link
Author

Does the problem still persist? Are there any other problems with this pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants