def execute_task_async(task_func, task_id, context):
    """
    Global function run for Task. multiprocessing requires a top level function.
    :param task_func: function: function to run (must be pickle-able)
    :param task_id: int: unique id of this task
    :param context: object: single argument to task_func (must be pickle-able)
    :return: (task_id, object): return passed in task id and result object
    """
    try:
        result = task_func(context)
        return task_id, result
    except:
        # Put all exception text into an exception and raise that so main process will print this out
        raise Exception("".join(traceback.format_exception(*sys.exc_info())))
Global function run for Task. multiprocessing requires a top level function.
    :param task_func: function: function to run (must be pickle-able)
    :param task_id: int: unique id of this task
    :param context: object: single argument to task_func (must be pickle-able)
    :return: (task_id, object): return passed in task id and result object