class_docstr: Stateful object able to manage temporary folder and pickles
  
  It exposes:
  - a per-context folder name resolving API that memmap-based reducers will
    rely on to know where to pickle the temporary memmaps
  - a temporary file/folder management API that internally uses the
    resource_tracker.
class_docstr_tok: ["Stateful","object","able","to","manage","temporary","folder","and","pickles","It","exposes",":","-","a","per-context","folder","name","resolving","API","that","memmap-based","reducers","will","rely","on","to","know","where","to","pickle","the","temporary","memmaps","-","a","temporary","file\/folder","management","API","that","internally","uses","the","resource_tracker","."]
code: def register_folder_finalizer(self, pool_subfolder, context_id):
      # Register the garbage collector at program exit in case caller forgets
      # to call terminate explicitly: note we do not pass any reference to
      # ensure that this callback won't prevent garbage collection of
      # parallel instance and related file handler resources such as POSIX
      # semaphores and pipes
      pool_module_name = whichmodule(delete_folder, "delete_folder")
      resource_tracker.register(pool_subfolder, "folder")
  
      def _cleanup():
          # In some cases the Python runtime seems to set delete_folder to
          # None just before exiting when accessing the delete_folder
          # function from the closure namespace. So instead we reimport
          # the delete_folder function explicitly.
          # https://github.com/joblib/joblib/issues/328
          # We cannot just use from 'joblib.pool import delete_folder'
          # because joblib should only use relative imports to allow
          # easy vendoring.
          delete_folder = __import__(
              pool_module_name, fromlist=["delete_folder"]
          ).delete_folder
          try:
              delete_folder(pool_subfolder, allow_non_empty=True)
              resource_tracker.unregister(pool_subfolder, "folder")
          except OSError:
              warnings.warn(
                  "Failed to delete temporary folder: {}".format(
                      pool_subfolder
                  )
              )
  
      self._finalizers[context_id] = atexit.register(_cleanup)
  
imports: from mmap import mmap
  import errno
  import os
  import stat
  import threading
  import atexit
  import tempfile
  import time
  import warnings
  import weakref
  from uuid import uuid4
  from multiprocessing import util
  from pickle import whichmodule, loads, dumps, HIGHEST_PROTOCOL, PicklingError
  from .numpy_pickle import dump, load, load_temporary_memmap
  from .backports import make_memmap
  from .disk import delete_folder
  from .externals.loky.backend import resource_tracker
label_desc: Use image node_id 5 for calling the TemporaryResourcesManager obj's underlying member method code with example usage: obj.register_folder_finalizer(pool_subfolder, context_id) without return types