def _process_wrapper(function, upwards, profile, *args, **kwargs):
"""Wrap a process with additional features."""
try:
if profile:
_run_profiler(function, *args, **kwargs)
else:
function(*args, **kwargs)
except Exception:
process = multiprocessing.current_process()
info = sys.exc_info()
exception = traceback.format_exception(
info[0], info[1], info[2].tb_next)
_send_message(upwards, _MESSAGE_ERROR,
process_id=process.pid,
process_name=process.name,
message=''.join(exception).rstrip())
finally:
upwards.close()
评论列表
文章目录