Loading [MathJax]/extensions/tex2jax.js
distributedBase Class Reference

Base class for distributed processing. More...

+ Inheritance diagram for distributedBase:

Public Member Functions

def __init__ (self)
 Instantiates the distributed base Object. More...
 
def submit (self, module=None, finishedText=None, userData=None)
 Submits modules to the processor which are then run. More...
 
def join (self, raiseExceptions=True)
 Waits for all incomplete runs to be finished. More...
 
def submit_and_join (self, module=None, finishedText=None, userData=None, raiseExceptions=True)
 Module is submitted to a worker, then waits until all the processes are finished. More...
 
def __len__ (self)
 Enables length query of the multiprocessor object :return: length of the result list. More...
 
def __getitem__ (self, idx)
 Enables index queries of the multiprocessor object :param: index of the desired module :return: the module itself. More...
 
def was_successful (self, idx)
 Gives information about whether or not a module run was successful :param idx: index of the module :return: Boolean. More...
 
def get_result (self, idx)
 Returns the result of a module run :param idx: index of the module :return : either the result of the module or an exception that occured during that module run. More...
 
def get_userdata (self, idx)
 Returns the userdata back to the user. More...
 
def get_error (self, idx)
 Returns an exception that occured during a module run :param: index of a module :return: exception. More...
 
def clear (self, logger=None)
 Clears the processor, i.e. More...
 
- Public Member Functions inherited from processorInterface
def submit (self)
 
def submit_and_join (self)
 
def join (self)
 
def clear (self)
 
def close (self)
 

Public Attributes

 results
 
 logger
 
 not_joined_yet
 

Detailed Description

Base class for distributed processing.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self)

Instantiates the distributed base Object.

:return: None

References local.logger, distributedBase.logger, local.not_joined_yet, distributedBase.not_joined_yet, local.results, and distributedBase.results.

Member Function Documentation

◆ __getitem__()

def __getitem__ (   self,
  idx 
)

Enables index queries of the multiprocessor object :param: index of the desired module :return: the module itself.

References local.results, and distributedBase.results.

◆ __len__()

def __len__ (   self)

Enables length query of the multiprocessor object :return: length of the result list.

References local.results, and distributedBase.results.

◆ clear()

def clear (   self,
  logger = None 
)

Clears the processor, i.e.

the result list :return: None

References local.logger, distributedBase.logger, local.results, and distributedBase.results.

◆ get_error()

def get_error (   self,
  idx 
)

Returns an exception that occured during a module run :param: index of a module :return: exception.

References local.results, and distributedBase.results.

◆ get_result()

def get_result (   self,
  idx 
)

Returns the result of a module run :param idx: index of the module :return : either the result of the module or an exception that occured during that module run.

References local.results, and distributedBase.results.

◆ get_userdata()

def get_userdata (   self,
  idx 
)

Returns the userdata back to the user.

:param idx: index of the module :return: userdata

References local.results, and distributedBase.results.

◆ join()

def join (   self,
  raiseExceptions = True 
)

Waits for all incomplete runs to be finished.

:param raiseExceptions: if True, exceptions are raised :return: None

References local._handle_errors(), distributedBase._handle_errors(), local.not_joined_yet, distributedBase.not_joined_yet, local.results, and distributedBase.results.

Referenced by multiprocess.close().

◆ submit()

def submit (   self,
  module = None,
  finishedText = None,
  userData = None 
)

Submits modules to the processor which are then run.

:param module: input module (might be none, if the module should not be run because the output already exists. But still an entry is added to the result list) :param finishedText: text to be printed when the module run is complete :param userData: Option arbitrary user data that will be passed to the result object (useful for cases where the module is None and the relevant output file can be communicated as userData) :return: None

References distributedBase._start(), local.not_joined_yet, distributedBase.not_joined_yet, local.results, and distributedBase.results.

◆ submit_and_join()

def submit_and_join (   self,
  module = None,
  finishedText = None,
  userData = None,
  raiseExceptions = True 
)

Module is submitted to a worker, then waits until all the processes are finished.

:param module: module to be run :param finishedText: text to be printed when the module run is complete :param userData: data to be input by the user (to be implemented) :param raiseExceptions: if True, exceptions are raised :return: None

References local._handle_errors(), distributedBase._handle_errors(), distributedBase._start(), local.not_joined_yet, distributedBase.not_joined_yet, local.results, and distributedBase.results.

◆ was_successful()

def was_successful (   self,
  idx 
)

Gives information about whether or not a module run was successful :param idx: index of the module :return: Boolean.

References local.results, and distributedBase.results.