def dump_processes():
 output_file = (PROFILING_OUTPUT_FMT % get_filename_fmt())
 data = {}
 for child in multiprocessing.active_children():
  pid = child._popen.pid
  child_data = {'name': child.name, 'daemon': child.daemon, 'exitcode': child.exitcode, 'target': child._target.__name__, 'args': [], 'kwargs': {}}
  for arg in child._args:
   try:
    json.dumps(arg)
   except (TypeError, UnicodeDecodeError):
    try:
     child_data['args'].append(arg.__class__.__name__)
    except:
     child_data['args'].append('undefined')
   else:
    child_data['args'].append(arg)
  for (key, value) in child._kwargs.iteritems():
   try:
    json.dumps(value)
   except (TypeError, UnicodeDecodeError):
    try:
     child_data['kwargs'][key] = value.__class__.__name__
    except:
     child_data['kwargs'][key] = 'undefined'
   else:
    child_data['kwargs'][key] = value
  data[pid] = child_data
 json.dump(data, file(output_file, 'w'), indent=4)

def dump_processes ( ) : output_file = ( PROFILING_OUTPUT_FMT % get_filename_fmt ( ) ) data = { } for child in multiprocessing . active_children ( ) : pid = child . _popen . pid child_data = { 'name' : child . name , 'daemon' : child . daemon , 'exitcode' : child . exitcode , 'target' : child . _target . __name__ , 'args' : [ ] , 'kwargs' : { } } for arg in child . _args : try : json . dumps ( arg ) except ( TypeError , UnicodeDecodeError ) : try : child_data [ 'args' ] . append ( arg . __class__ . __name__ ) except : child_data [ 'args' ] . append ( 'undefined' ) else : child_data [ 'args' ] . append ( arg ) for ( key , value ) in child . _kwargs . iteritems ( ) : try : json . dumps ( value ) except ( TypeError , UnicodeDecodeError ) : try : child_data [ 'kwargs' ] [ key ] = value . __class__ . __name__ except : child_data [ 'kwargs' ] [ key ] = 'undefined' else : child_data [ 'kwargs' ] [ key ] = value data [ pid ] = child_data json . dump ( data , file ( output_file , 'w' ) , indent = 4 )
dumps sub-process information to a file .