code: def _fork_callback_after_child():
      if not PatchOsFork._current_task:
          return
  
      from ..task import Task
  
      # force creating a Task
      task = Task.current_task()
      if not task:
          return
  
      if not Task._report_subprocess_enabled:
          # https://stackoverflow.com/a/34507557
          # NOTICE: subprocesses do not exit through exit we have to register signals
          if task._Task__exit_hook:
              task._Task__exit_hook.register_signal_and_exception_hooks()
      else:
          # noinspection PyProtectedMember
          task._remove_signal_hooks()
  
      # noinspection PyProtectedMember
      if Task._report_subprocess_enabled:
          # noinspection PyProtectedMember
          task._remove_exception_hooks()
  
      PatchOsFork._current_task = task
      # # Hack: now make sure we setup the reporter threads (Log+Reporter)
      # noinspection PyProtectedMember
      if not bool(task._report_subprocess_enabled):
          BackgroundMonitor.start_all(task=task)
  
      # if we are reporting into a subprocess, no need to further patch the exit functions
      if Task._report_subprocess_enabled:
          return
  
      # The signal handler method is Not enough, for the time being, we have both
      # even though it makes little sense
      # # if we got here patch the os._exit of our instance to call us
      def _at_exit_callback(*a_args, **a_kwargs):
          # just make sure we flush the internal state (the at exist caught by the external signal does the rest
          # in theory we should not have to do any of that, but for some reason if we do not
          # the signal is never caught by the signal call backs, not sure why....
          sleep(0.1)
          # Since at_exist handlers do not work on forked processes, we have to manually call them here
          if task:
              try:
                  # not to worry there is a double _at_exit protection implemented inside task._at_exit()
                  # noinspection PyProtectedMember
                  task._at_exit()
              except:  # noqa
                  pass
  
          # noinspection PyProtectedMember, PyUnresolvedReferences
          return os._org_exit(*a_args, **a_kwargs)
  
      if not hasattr(os, "_org_exit"):
          # noinspection PyProtectedMember, PyUnresolvedReferences
          os._org_exit = os._exit
  
      # noinspection PyProtectedMember
      # https://stackoverflow.com/a/34507557
      # NOTICE: subprocesses do not exit through exit, and in most cases not with _exit,
      # this means at_exit calls are Not registered respected
      os._exit = _at_exit_callback
  
imports: import os
  from functools import partial
  from time import sleep
  from multiprocessing import pool
  import six
  from ..config import TASK_LOG_ENVIRONMENT, running_remotely, config
  from ..utilities.process.mp import BackgroundMonitor
label_desc: Use image node_id 5 for calling the PatchOsFork obj's underlying member method code with example usage: obj._fork_callback_after_child() and returns: os