pyqtgraph/multiprocess/bootstrap.py
Luke Campagnola e21480855f multiprocess updates:
- avoid sending keyboard interrupt signals to child processes
  - parallelizer keeps better track of processes that die unexpectedly
  - added ability to specify a different executable when starting new processes
2012-08-17 16:15:13 -04:00

17 lines
711 B
Python

"""For starting up remote processes"""
import sys, pickle, os
if __name__ == '__main__':
os.setpgrp() ## prevents signals (notably keyboard interrupt) being forwarded from parent to this process
name, port, authkey, targetStr, path = pickle.load(sys.stdin)
if path is not None:
## rewrite sys.path without assigning a new object--no idea who already has a reference to the existing list.
while len(sys.path) > 0:
sys.path.pop()
sys.path.extend(path)
#import pyqtgraph
#import pyqtgraph.multiprocess.processes
target = pickle.loads(targetStr) ## unpickling the target should import everything we need
target(name, port, authkey)
sys.exit(0)