class_docstr: Execute workflow with multiprocessing, not sending more jobs at once
  than the system can support.
  
  The plugin_args input to run can be used to control the multiprocessing
  execution and defining the maximum amount of memory and threads that
  should be used. When those parameters are not specified,
  the number of threads and memory of the system is used.
  
  System consuming nodes should be tagged::
  
    memory_consuming_node.mem_gb = 8
    thread_consuming_node.n_procs = 16
  
  The default number of threads and memory are set at node
  creation, and are 1 and 0.25GB respectively.
  
  Currently supported options are:
  
  - non_daemon: boolean flag to execute as non-daemon processes
  - n_procs: maximum number of threads to be executed in parallel
  - memory_gb: maximum memory (in GB) that can be used at once.
  - raise_insufficient: raise error if the requested resources for
      a node over the maximum `n_procs` and/or `memory_gb`
      (default is ``True``).
  - scheduler: sort jobs topologically (``'tsort'``, default value)
      or prioritize jobs by, first, memory consumption and, second,
      number of threads (``'mem_thread'`` option).
  - mp_context: name of multiprocessing context to use
class_docstr_tok: ["Execute","workflow","with","multiprocessing",",","not","sending","more","jobs","at","once","than","the","system","can","support",".","The","plugin_args","input","to","run","can","be","used","to","control","the","multiprocessing","execution","and","defining","the","maximum","amount","of","memory","and","threads","that","should","be","used",".","When","those","parameters","are","not","specified",",","the","number","of","threads","and","memory","of","the","system","is","used",".","System","consuming","nodes","should","be","tagged",":",":","memory_consuming_node.mem_gb","=","8","thread_consuming_node.n_procs","=","16","The","default","number","of","threads","and","memory","are","set","at","node","creation",",","and","are","1","and","0.25GB","respectively",".","Currently","supported","options","are",":","-","non_daemon",":","boolean","flag","to","execute","as","non-daemon","processes","-","n_procs",":","maximum","number","of","threads","to","be","executed","in","parallel","-","memory_gb",":","maximum","memory","(","in","GB",")","that","can","be","used","at","once",".","-","raise_insufficient",":","raise","error","if","the","requested","resources","for","a","node","over","the","maximum","`","n_procs","`","and\/or","`","memory_gb","`","(","default","is","``","True","``",")",".","-","scheduler",":","sort","jobs","topologically","(","``","'tsort","'","``",",","default","value",")","or","prioritize","jobs","by",",","first",",","memory","consumption","and",",","second",",","number","of","threads","(","``","'mem_thread","'","``","option",")",".","-","mp_context",":","name","of","multiprocessing","context","to","use"]
docstr: Make sure there are resources available
docstr_tok: ["Make","sure","there","are","resources","available"]
code: def _check_resources(self, running_tasks):
      """
      Make sure there are resources available
      """
      free_memory_gb = self.memory_gb
      free_processors = self.processors
      for _, jobid in running_tasks:
          free_memory_gb -= min(
              self.procs[jobid].mem_gb, free_memory_gb
          )
          free_processors -= min(
              self.procs[jobid].n_procs, free_processors
          )
  
      return free_memory_gb, free_processors
  
imports: import os
  import multiprocessing
  from concurrent.futures import ProcessPoolExecutor, wait
  from traceback import format_exception
  import sys
  from logging import INFO
  import gc
  from copy import deepcopy
  import numpy
  from ...None import logging
  from ...utils.profiler import get_system_total_memory_gb
  from ..engine import MapNode
  from .base import DistributedPluginBase
label_desc: Use image node_id 8 for calling the MultiProcPlugin obj's underlying member method code with example usage: obj._check_resources(running_tasks) and returns: free_memory_gb,  free_processors