class_docstr: Class for ultra-simple inline parallelization on multi-core CPUs
  
  Example::
  
      ## Here is the serial (single-process) task:
      
      tasks = [1, 2, 4, 8]
      results = []
      for task in tasks:
          result = processTask(task)
          results.append(result)
      print(results)
      
      
      ## Here is the parallelized version:
      
      tasks = [1, 2, 4, 8]
      results = []
      with Parallelize(tasks, workers=4, results=results) as tasker:
          for task in tasker:
              result = processTask(task)
              tasker.results.append(result)
      print(results)
      
      
  The only major caveat is that *result* in the example above must be picklable,
  since it is automatically sent via pipe back to the parent process.
class_docstr_tok: ["Class","for","ultra-simple","inline","parallelization","on","multi-core","CPUs","Example",":",":","#","#","Here","is","the","serial","(","single-process",")","task",":","tasks","=","[","1",",","2",",","4",",","8","]","results","=","[","]","for","task","in","tasks",":","result","=","processTask","(","task",")","results.append","(","result",")","print","(","results",")","#","#","Here","is","the","parallelized","version",":","tasks","=","[","1",",","2",",","4",",","8","]","results","=","[","]","with","Parallelize","(","tasks",",","workers=4",",","results=results",")","as","tasker",":","for","task","in","tasker",":","result","=","processTask","(","task",")","tasker.results.append","(","result",")","print","(","results",")","The","only","major","caveat","is","that","*","result","*","in","the","example","above","must","be","picklable",",","since","it","is","automatically","sent","via","pipe","back","to","the","parent","process","."]
docstr: ===============  ===================================================================
  **Arguments:**
  tasks            list of objects to be processed (Parallelize will determine how to 
                   distribute the tasks). If unspecified, then each worker will receive
                   a single task with a unique id number.
  workers          number of worker processes or None to use number of CPUs in the 
                   system
  progressDialog   optional dict of arguments for ProgressDialog
                   to update while tasks are processed
  randomReseed     If True, each forked process will reseed its random number generator
                   to ensure independent results. Works with the built-in random
                   and numpy.random.
  kwds             objects to be shared by proxy with child processes (they will 
                   appear as attributes of the tasker)
  ===============  ===================================================================
docstr_tok: ["===============","===================================================================","*","*","Arguments",":","*","*","tasks","list","of","objects","to","be","processed","(","Parallelize","will","determine","how","to","distribute","the","tasks",")",".","If","unspecified",",","then","each","worker","will","receive","a","single","task","with","a","unique","id","number",".","workers","number","of","worker","processes","or","None","to","use","number","of","CPUs","in","the","system","progressDialog","optional","dict","of","arguments","for","ProgressDialog","to","update","while","tasks","are","processed","randomReseed","If","True",",","each","forked","process","will","reseed","its","random","number","generator","to","ensure","independent","results",".","Works","with","the","built-in","random","and","numpy.random",".","kwds","objects","to","be","shared","by","proxy","with","child","processes","(","they","will","appear","as","attributes","of","the","tasker",")","===============","==================================================================="]
code: def __init__(
      self,
      tasks=None,
      workers=None,
      block=True,
      progressDialog=None,
      randomReseed=True,
      **kwds,
  ):
      """
      ===============  ===================================================================
      **Arguments:**
      tasks            list of objects to be processed (Parallelize will determine how to
                       distribute the tasks). If unspecified, then each worker will receive
                       a single task with a unique id number.
      workers          number of worker processes or None to use number of CPUs in the
                       system
      progressDialog   optional dict of arguments for ProgressDialog
                       to update while tasks are processed
      randomReseed     If True, each forked process will reseed its random number generator
                       to ensure independent results. Works with the built-in random
                       and numpy.random.
      kwds             objects to be shared by proxy with child processes (they will
                       appear as attributes of the tasker)
      ===============  ===================================================================
      """
  
      ## Generate progress dialog.
      ## Note that we want to avoid letting forked child processes play with progress dialogs..
      self.showProgress = False
      if progressDialog is not None:
          self.showProgress = True
          if isinstance(progressDialog, str):
              progressDialog = {"labelText": progressDialog}
          from ..widgets.ProgressDialog import ProgressDialog
  
          self.progressDlg = ProgressDialog(**progressDialog)
  
      if workers is None:
          workers = self.suggestedWorkerCount()
      if not hasattr(os, "fork"):
          workers = 1
      self.workers = workers
      if tasks is None:
          tasks = range(workers)
      self.tasks = list(tasks)
      self.reseed = randomReseed
      self.kwds = kwds.copy()
      self.kwds["_taskStarted"] = self._taskStarted
  
imports: import multiprocessing
  import os
  import re
  import sys
  import time
  from .processes import ForkedProcess
  from .remoteproxy import ClosedError
label_desc: Use image node_id 1 to create a new Parallelize object from inherited base classes: object with example: obj = Parallelize(tasks, workers, block, progressDialog, randomReseed)