Skip to content

pman overview

Rudolph Pienaar edited this page Mar 8, 2017 · 21 revisions

pman

Abstract

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.

Installation / setup

See the main page here.

Startup

See the startup docs here.

Running

Quick start

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 which pman will listen;
  • --listeners 12 that specifies how many threads to spawn. Each thread will service a request; --listeners 12 means this instance of pman 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. -- the listeners denotes the number of effectively simultaneous requests to handle, and a request handler persists only as long as it takes to service the request. If pman is started with --listeners 1 this means that if a service request is being processed pman will not respond to other requests until the current request is complete.

What to expect

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.

--30--

Clone this wiki locally