Changeset 1239

Show
Ignore:
Timestamp:
03/27/09 19:07:08 (16 months ago)
Author:
mturk
Message:

Adding (from bitbucket experimental repo) the rpdb command. If you run a
simulation with --rpdb, uncaught exceptions will spawn a (localhost-bound) pdb
instance that responds via XML-RPC. This enables you to pdb individual MPI
tasks, if you are running on the node that the tasks are on.

For instance,

mpirun -np 4 python2.6 some_script_with_a_bug.py --parallel --rpdb

will spawn four XML-RPC servers with embedded pdb on an uncaught exception,
each of which can be communicated with via the command

yt rpdb [0123]

where the task you want to communicate with is the argument. When the command
'shutdown' has been issued to a rpdb server, it will shut down and barrier,
waiting for all the other tasks to barrier to complete the task. So you need
to 'shutdown' all of them before the tasks all die.

I've used this to debug some parallel bugs lately; very handy... Note that it
binds only to localhost, but this is STILL a security flaw if you have other
users on the system. SO -- BEWARE.

Location:
trunk/yt
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/yt/commands.py

    r1182 r1239  
    274274        pc.save(os.path.join(opts.output,"%s" % (pf))) 
    275275 
     276    def do_rpdb(self, subcmd, opts, arg): 
     277        """ 
     278        Connect to a currently running (on localhost) rpd session. 
     279 
     280        Commands run with --rpdb will trigger an rpdb session with any 
     281        uncaught exceptions. 
     282 
     283        ${cmd_usage} [TASK_NUMER] 
     284        ${cmd_option_list} 
     285        """ 
     286        import rpdb 
     287        rpdb.run_rpdb(int(arg)) 
     288 
    276289def run_main(): 
    277290    for co in ["--parallel", "--paste"]: 
  • trunk/yt/funcs.py

    r1230 r1239  
    2424""" 
    2525 
    26 import time, types, signal, inspect, traceback, sys, pdb 
     26import time, types, signal, inspect, traceback, sys, pdb, rpdb 
    2727import progressbar as pb 
    2828from math import floor, ceil 
     
    5252if "--paste" in sys.argv: 
    5353    sys.excepthook = paste_traceback 
     54if "--rpdb" in sys.argv: 
     55    sys.excepthook = rpdb.rpdb_excepthook 
    5456 
    5557def blank_wrapper(f):