def _bootstrap(self): from multiprocessing import util global _current_process try: self._children = set() self._counter = itertools.count(1) try: sys.stdin.close() sys.stdin = open(os.devnull) except (OSError, ValueError): pass _current_process = self util._finalizer_registry.clear() util._run_after_forkers() util.info('child process calling self.run()') try: self.run() exitcode = 0 finally: util._exit_function() except SystemExit, e: if not e.args: exitcode = 1 elif type(e.args[0]) is int: exitcode = e.args[0] else: sys.stderr.write(e.args[0] + '\n') sys.stderr.flush() exitcode = 1
def bootstrap_2_6_6(self): """Pulled from python 2.6.6. Needed to ensure we have the fix from http://bugs.python.org/issue5313 when running on python version 2.6.2 or lower.""" try: self._children = set() self._counter = itertools.count(1) try: sys.stdin.close() sys.stdin = open(os.devnull) except (OSError, ValueError): pass multiprocessing._current_process = self util._finalizer_registry.clear() util._run_after_forkers() util.info("child process calling self.run()") try: self.run() exitcode = 0 finally: util._exit_function() except SystemExit, e: if not e.args: exitcode = 1 elif type(e.args[0]) is int: exitcode = e.args[0] else: sys.stderr.write(e.args[0] + "\n") sys.stderr.flush() exitcode = 1
def bootstrap_2_6_6(self): """Pulled from python 2.6.6. Needed to ensure we have the fix from http://bugs.python.org/issue5313 when running on python version 2.6.2 or lower.""" try: self._children = set() self._counter = itertools.count(1) try: sys.stdin.close() sys.stdin = open(os.devnull) except (OSError, ValueError): pass multiprocessing._current_process = self util._finalizer_registry.clear() util._run_after_forkers() util.info('child process calling self.run()') try: self.run() exitcode = 0 finally: util._exit_function() except SystemExit as e: if not e.args: exitcode = 1 elif type(e.args[0]) is int: exitcode = e.args[0] else: sys.stderr.write(e.args[0] + '\n') sys.stderr.flush() exitcode = 1 except: exitcode = 1 import traceback sys.stderr.write('Process %s:\n' % self.name) sys.stderr.flush() traceback.print_exc() util.info('process exiting with exitcode %d' % exitcode) return exitcode