HCE Project Python language Distributed Tasks Manager Application, Distributed Crawler Application and client API bindings.  2.0.0-chaika
Hierarchical Cluster Engine Python language binding
dc_postprocessor.PostprocessorTask.PostprocessorTask Class Reference
Inheritance diagram for dc_postprocessor.PostprocessorTask.PostprocessorTask:
Collaboration diagram for dc_postprocessor.PostprocessorTask.PostprocessorTask:

Classes

class  Meta
 

Public Member Functions

def __init__ (self)
 
def init (self)
 
def setup (self)
 
def run (self)
 
def finalize (self)
 
def instantiateModules (self)
 
def loadConfig (self)
 
def process (self)
 
- Public Member Functions inherited from dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass
def __init__ (self)
 
def setup (self)
 
def run (self)
 
def inputBatch (self)
 
def outputBatch (self)
 
def getConfigOption (self, sectionName, optionName, defaultValue=None)
 

Public Attributes

 modules
 
 modulesImport
 
 modulesOrder
 
 batch
 
- Public Attributes inherited from dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass
 exitCode
 
 logger
 
 configParser
 
 inputFile
 
 batch
 

Static Public Attributes

string CONFIG_OPTION_MODULES_IMPORT = 'modulesImport'
 
string CONFIG_OPTION_MODULES_ORDER = 'modulesOrder'
 
string PACKAGE_MAME = 'dc_postprocessor'
 
string ERROR_MSG_LOAD_CONFIG_OPTIONS = "Error load config options. Error: %s"
 
string ERROR_MSG_INSTANTIATE_MODULES = "Error instantiate modules. Error: %s"
 
string MSG_PROCESSING_STARTED = "Postprocessing for batch ID = %s started."
 
string MSG_PROCESSING_FINISHED = "Postprocessing for batch ID = %s finished."
 
- Static Public Attributes inherited from dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass
string MSG_ERROR_EMPTY_CONFIG_FILE_NAME = "Config file name is empty."
 
string MSG_ERROR_WRONG_CONFIG_FILE_NAME = "Config file name is wrong"
 
string MSG_ERROR_LOAD_APP_CONFIG = "Error loading application config file."
 
string MSG_ERROR_READ_LOG_CONFIG = "Error read log config file."
 
string MSG_ERROR_MISSED_SECTION = "Missed mandatory section '%s'"
 
string MSG_DEBUG_INPUT_PICKLE = "Input pickle: "
 
string MSG_DEBUG_INPUT_BATCH = "Input batch: "
 
string MSG_DEBUG_OUTPUT_BATCH = "Output batch: "
 
string MSG_DEBUG_OUTPUT_PICKLE = "Output pickle: "
 
string MSG_DEBUG_SEND_PICKLE = "Send pickle. Done."
 
string CONFIG_OPTION_LOG = "log"
 

Detailed Description

Definition at line 23 of file PostprocessorTask.py.

Constructor & Destructor Documentation

◆ __init__()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.__init__ (   self)

Definition at line 47 of file PostprocessorTask.py.

47  def __init__(self):
48  PostProcessingApplicationClass.__init__(self)
49 
50 # self.logger = None
51  self.modules = []
52  self.modulesImport = None
53  self.modulesOrder = None
54 
55 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ finalize()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.finalize (   self)

Definition at line 92 of file PostprocessorTask.py.

92  def finalize(self):
93  self.outputBatch()
94 
95 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.init (   self)

Definition at line 60 of file PostprocessorTask.py.

60  def init(self):
61  self.inputBatch()
62  self.loadConfig()
63  self.instantiateModules()
64 
65 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ instantiateModules()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.instantiateModules (   self)

Definition at line 100 of file PostprocessorTask.py.

100  def instantiateModules(self):
101  for m in self.modulesImport:
102  try:
103  im = importlib.import_module(self.PACKAGE_MAME + '.' + m)
104  mi = getattr(im, m)(self.getConfigOption, self.logger)
105  mi.init()
106  self.modules.append(mi)
107  except Exception, err:
108  self.logger.error(self.ERROR_MSG_INSTANTIATE_MODULES % str(err))
109 
110 
111 # # #load log config file
112 # #
113 # # @return - None
114 # def loadLogConfig(self, configName):
115 #
116 # try:
117 # if not isinstance(configName, str) or len(configName) == 0:
118 # raise Exception(self.MSG_ERROR_EMPTY_CONFIG_FILE_NAME)
119 #
120 # logging.config.fileConfig(configName)
121 #
122 # # call rotation log files and initialization logger
123 # self.logger = Utils.MPLogger().getLogger()
124 # # self.logger = logging.getLogger(APP_CONSTS.LOGGER_NAME)
125 #
126 # except Exception, err:
127 # raise Exception(self.MSG_ERROR_READ_LOG_CONFIG + ' ' + str(err))
128 
129 
-mask-info
Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadConfig()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.loadConfig (   self)

Definition at line 134 of file PostprocessorTask.py.

134  def loadConfig(self):
135  try:
136 # self.loadLogConfig(self.getConfigOption(APP_CONSTS.CONFIG_APPLICATION_SECTION_NAME, self.CONFIG_OPTION_LOG))
137 
138 
139  self.modulesImport = self.getConfigOption(self.__class__.__name__, self.CONFIG_OPTION_MODULES_IMPORT).split(',')
140  self.modulesOrder = self.getConfigOption(self.__class__.__name__, self.CONFIG_OPTION_MODULES_ORDER).split(',')
141 
142  self.modulesImport = [moduleName for moduleName in self.modulesImport if moduleName != ""]
143  self.modulesOrder = [moduleName for moduleName in self.modulesOrder if moduleName != ""]
144 
145  self.logger.debug("self.modulesImport: %s", str(self.modulesImport))
146  self.logger.debug("self.modulesOrder: %s", str(self.modulesOrder))
147 
148  except Exception, err:
149  raise Exception(self.ERROR_MSG_LOAD_CONFIG_OPTIONS % str(err))
150 
151 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.process (   self)

Definition at line 156 of file PostprocessorTask.py.

156  def process(self):
157 
158  self.logger.debug(self.MSG_PROCESSING_STARTED, str(self.batch.id))
159  # process batch execution
160  for moduleName in self.modulesOrder:
161  for moduleInstance in self.modules:
162  # if isinstance(moduleInstance, moduleName):
163  if moduleName in str(type(moduleInstance)):
164  self.batch = moduleInstance.processBatch(self.batch)
165 
166  # process batch item execution
167  for i in xrange(len(self.batch.items)):
168  for moduleName in self.modulesOrder:
169  for moduleInstance in self.modules:
170  # if isinstance(moduleInstance, moduleName):
171  if moduleName in str(type(moduleInstance)):
172  self.batch.items[i] = moduleInstance.processBatchItem(self.batch.items[i])
173 
174  self.logger.debug(self.MSG_PROCESSING_FINISHED, str(self.batch.id))
Here is the caller graph for this function:

◆ run()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.run (   self)

Definition at line 78 of file PostprocessorTask.py.

78  def run(self):
79  PostProcessingApplicationClass.run(self)
80 
81  self.init()
82  self.process()
83  self.finalize()
84  # finish logging
85  self.logger.info(APP_CONSTS.LOGGER_DELIMITER_LINE)
86 
87 
Here is the call graph for this function:

◆ setup()

def dc_postprocessor.PostprocessorTask.PostprocessorTask.setup (   self)

Definition at line 70 of file PostprocessorTask.py.

70  def setup(self):
71  PostProcessingApplicationClass.setup(self)
72 
73 

Member Data Documentation

◆ batch

dc_postprocessor.PostprocessorTask.PostprocessorTask.batch

Definition at line 164 of file PostprocessorTask.py.

◆ CONFIG_OPTION_MODULES_IMPORT

string dc_postprocessor.PostprocessorTask.PostprocessorTask.CONFIG_OPTION_MODULES_IMPORT = 'modulesImport'
static

Definition at line 26 of file PostprocessorTask.py.

◆ CONFIG_OPTION_MODULES_ORDER

string dc_postprocessor.PostprocessorTask.PostprocessorTask.CONFIG_OPTION_MODULES_ORDER = 'modulesOrder'
static

Definition at line 27 of file PostprocessorTask.py.

◆ ERROR_MSG_INSTANTIATE_MODULES

string dc_postprocessor.PostprocessorTask.PostprocessorTask.ERROR_MSG_INSTANTIATE_MODULES = "Error instantiate modules. Error: %s"
static

Definition at line 33 of file PostprocessorTask.py.

◆ ERROR_MSG_LOAD_CONFIG_OPTIONS

string dc_postprocessor.PostprocessorTask.PostprocessorTask.ERROR_MSG_LOAD_CONFIG_OPTIONS = "Error load config options. Error: %s"
static

Definition at line 32 of file PostprocessorTask.py.

◆ modules

dc_postprocessor.PostprocessorTask.PostprocessorTask.modules

Definition at line 51 of file PostprocessorTask.py.

◆ modulesImport

dc_postprocessor.PostprocessorTask.PostprocessorTask.modulesImport

Definition at line 52 of file PostprocessorTask.py.

◆ modulesOrder

dc_postprocessor.PostprocessorTask.PostprocessorTask.modulesOrder

Definition at line 53 of file PostprocessorTask.py.

◆ MSG_PROCESSING_FINISHED

string dc_postprocessor.PostprocessorTask.PostprocessorTask.MSG_PROCESSING_FINISHED = "Postprocessing for batch ID = %s finished."
static

Definition at line 37 of file PostprocessorTask.py.

◆ MSG_PROCESSING_STARTED

string dc_postprocessor.PostprocessorTask.PostprocessorTask.MSG_PROCESSING_STARTED = "Postprocessing for batch ID = %s started."
static

Definition at line 36 of file PostprocessorTask.py.

◆ PACKAGE_MAME

string dc_postprocessor.PostprocessorTask.PostprocessorTask.PACKAGE_MAME = 'dc_postprocessor'
static

Definition at line 29 of file PostprocessorTask.py.


The documentation for this class was generated from the following file: