-
Notifications
You must be signed in to change notification settings - Fork 34
pman overview
pman
manages processes, i.e. programs or applications that are run by an underlying system. For the most part, these processes are command line applications (i.e. have no GUI) and usually do not interact really with a user at all. The purpose of pman
is to provide other software agents the ability to execute processes via http
and then be able to respond to these agents when queried about the process. In the simplest case, pman
is given some string text that is the command line of the program to run on an underlying system shell. This program is executed, and pman
can then be asked for information about this process.
See the main page here.
See the startup docs here.
pman
is a service, or daemon, that starts up and then simply listens for things to do. To start up the service, run
pman --raw 1 --http --port 5010 --listeners 12
see the in-line help for information on each of the passed flags, but importantly here is the
-
--port 5010
that specifies the port on whichpman
will listen; -
--listeners 12
that specifies how many threads to spawn. Each thread will service a request;--listeners 12
means this instance ofpman
can service 12 requests simultaneously. This is important to understand. Once a job has been started or a request serviced,pman
is ready to manage another request. -- thelisteners
denotes the number of effectively simultaneous requests to handle, and a request handler persists only as long as it takes to service the request. Ifpman
is started with--listeners 1
this means that if a service request is being processedpman
will not respond to other requests until the current request is complete.
When started as above, the terminal should display something like:
2017-03-03 21:07:29.214989 | <_MainThread(MainThread, started 140488191162112)> | __init__ |
2017-03-03 21:07:29.215204 | <_MainThread(MainThread, started 140488191162112)> | __init__ |
+-----------------------------------------------+
| Welcome to the pman process management system |
+-----------------------------------------------+
2017-03-03 21:07:29.215493 | <_MainThread(MainThread, started 140488191162112)> | __init__ |
'pman' is a client/server system that allows users to monitor
and control processes on (typically) Linux systems. Actual
processes are spawned using the 'crunner' module and as such
are ssh and HPC aware.
The 'pman' server can be queried for running processes, lost/dead
processes, exit status, etc.
Communication from the 'pman' server is via JSON constructs. See the
github page for more information.
Typical calling syntax is:
./pman.py --raw 1 \
--http \
--ip <someIP> \
--port 5010 \
--listeners <listeners>
2017-03-03 21:07:29.215749 | <_MainThread(MainThread, started 140488191162112)> | col2_print | Server is listening on
2017-03-03 21:07:29.216020 | <_MainThread(MainThread, started 140488191162112)> | col2_print | tcp://172.17.0.2:5010
2017-03-03 21:07:29.216291 | <_MainThread(MainThread, started 140488191162112)> | col2_print | Router raw mode
2017-03-03 21:07:29.216554 | <_MainThread(MainThread, started 140488191162112)> | col2_print | 1
2017-03-03 21:07:29.216823 | <_MainThread(MainThread, started 140488191162112)> | col2_print | HTTP response back mode
2017-03-03 21:07:29.217085 | <_MainThread(MainThread, started 140488191162112)> | col2_print | 1
Note in the above example the service is listening on host 172.17.0.2:5010
which will be used in all subsequent examples.
It is often useful to keep an eye on this terminal while using pman
since this captures all logging that pman
will typically perform. To direct logs to a file, start pman
with
pman --raw 1 --http --port 5010 --listeners 12 --debugToFile --debugFile ~/pman.log
Note that it is a good idea to specify the log target with a directory prefix/specifier.