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.PostProcessingApplicationClass.PostProcessingApplicationClass Class Reference
Inheritance diagram for dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass:
Collaboration diagram for dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass:

Classes

class  Meta
 

Public Member Functions

def __init__ (self)
 
def setup (self)
 
def run (self)
 
def inputBatch (self)
 
def outputBatch (self)
 
def getConfigOption (self, sectionName, optionName, defaultValue=None)
 

Public Attributes

 exitCode
 
 logger
 
 configParser
 
 inputFile
 
 batch
 

Static Public Attributes

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"
 

Private Member Functions

def __loadLogConfig (self, configName)
 
def __loadAppConfig (self, configName)
 
def __initApp (self)
 
def __getInputPickle (self)
 
def __unpickleInput (self, inputPickle)
 
def __createOutputPickle (self, outputBatch)
 
def __sendPickle (self, outputPickle)
 

Detailed Description

Definition at line 32 of file PostProcessingApplicationClass.py.

Constructor & Destructor Documentation

◆ __init__()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__init__ (   self)

Definition at line 60 of file PostProcessingApplicationClass.py.

60  def __init__(self):
61  # call base class __init__ method
62  foundation.CementApp.__init__(self)
63  self.exitCode = APP_CONSTS.EXIT_SUCCESS
64  self.logger = None
65  self.configParser = None
66  self.inputFile = None
67  self.batch = None
68 
69 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ __createOutputPickle()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__createOutputPickle (   self,
  outputBatch 
)
private

Definition at line 181 of file PostProcessingApplicationClass.py.

181  def __createOutputPickle(self, outputBatch):
182  # self.logger.debug(self.MSG_DEBUG_OUTPUT_BATCH + str(outputBatch))
183  outputPickle = pickle.dumps(outputBatch)
184  # self.logger.debug(self.MSG_DEBUG_OUTPUT_PICKLE + str(outputPickle))
185 
186  return outputPickle
187 
188 
Here is the caller graph for this function:

◆ __getInputPickle()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__getInputPickle (   self)
private

Definition at line 154 of file PostProcessingApplicationClass.py.

154  def __getInputPickle(self):
155 
156  if self.inputFile is None:
157  inputPickle = sys.stdin.read()
158  else:
159  f = open(self.inputFile, 'r')
160  inputPickle = f.read()
161  f.close()
162  # self.logger.debug(self.MSG_DEBUG_INPUT_PICKLE + '\n' + str(inputPickle))
163 
164  return inputPickle
165 
166 
Here is the caller graph for this function:

◆ __initApp()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__initApp (   self)
private

Definition at line 139 of file PostProcessingApplicationClass.py.

139  def __initApp(self):
140  if self.pargs.config:
141  # load app config
142  self.configParser = self.__loadAppConfig(self.pargs.config)
143  # load input file if necessary
144  if self.pargs.inputFile:
145  self.inputFile = str(self.pargs.inputFile)
146  else:
147  raise Exception(self.MSG_ERROR_LOAD_APP_CONFIG)
148 
149 
def __initApp(self, configName=None)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __loadAppConfig()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__loadAppConfig (   self,
  configName 
)
private

Definition at line 110 of file PostProcessingApplicationClass.py.

110  def __loadAppConfig(self, configName):
111  # variable for result
112  configParser = None
113  try:
114  config = ConfigParser.ConfigParser()
115  config.optionxform = str
116 
117  readOk = config.read(configName)
118 
119  if len(readOk) == 0:
120  raise Exception(self.MSG_ERROR_WRONG_CONFIG_FILE_NAME + ": " + configName)
121 
122  if not config.has_section(APP_CONSTS.CONFIG_APPLICATION_SECTION_NAME):
123  raise Exception(self.MSG_ERROR_MISSED_SECTION % str(APP_CONSTS.CONFIG_APPLICATION_SECTION_NAME))
124 
125  # load logger config file and instantiate logger instance
126  self.__loadLogConfig(config.get(APP_CONSTS.CONFIG_APPLICATION_SECTION_NAME, self.CONFIG_OPTION_LOG))
127 
128  configParser = config
129  except Exception, err:
130  raise Exception(self.MSG_ERROR_LOAD_APP_CONFIG + ' ' + str(err))
131 
132  return configParser
133 
134 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __loadLogConfig()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__loadLogConfig (   self,
  configName 
)
private

Definition at line 91 of file PostProcessingApplicationClass.py.

91  def __loadLogConfig(self, configName):
92 
93  try:
94  if not isinstance(configName, str) or len(configName) == 0:
95  raise Exception(self.MSG_ERROR_EMPTY_CONFIG_FILE_NAME)
96 
97  logging.config.fileConfig(configName)
98 
99  # call rotation log files and initialization logger
100  self.logger = Utils.MPLogger().getLogger()
101 
102  except Exception, err:
103  raise Exception(self.MSG_ERROR_READ_LOG_CONFIG + ' ' + str(err))
104 
105 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ __sendPickle()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__sendPickle (   self,
  outputPickle 
)
private

Definition at line 193 of file PostProcessingApplicationClass.py.

193  def __sendPickle(self, outputPickle):
194  sys.stdout.write(outputPickle)
195  # self.logger.debug(self.MSG_DEBUG_SEND_PICKLE)
196 
197 
Here is the caller graph for this function:

◆ __unpickleInput()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.__unpickleInput (   self,
  inputPickle 
)
private

Definition at line 170 of file PostProcessingApplicationClass.py.

170  def __unpickleInput(self, inputPickle):
171  inputBatch = pickle.loads(inputPickle)
172  # self.logger.debug(self.MSG_DEBUG_INPUT_BATCH + Utils.varDump(inputBatch))
173 
174  return inputBatch
175 
176 
Here is the caller graph for this function:

◆ getConfigOption()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.getConfigOption (   self,
  sectionName,
  optionName,
  defaultValue = None 
)

Definition at line 219 of file PostProcessingApplicationClass.py.

219  def getConfigOption(self, sectionName, optionName, defaultValue=None):
220  # variable for result
221  ret = defaultValue
222  try:
223  if self.configParser is not None:
224  ret = self.configParser.get(sectionName, optionName)
225  except Exception, err:
226  raise Exception(str(err))
227 
228  return ret
229 
Here is the caller graph for this function:

◆ inputBatch()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.inputBatch (   self)

Definition at line 202 of file PostProcessingApplicationClass.py.

202  def inputBatch(self):
203  self.batch = self.__unpickleInput(self.__getInputPickle())
204 
205 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ outputBatch()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.outputBatch (   self)

Definition at line 210 of file PostProcessingApplicationClass.py.

210  def outputBatch(self):
211  self.__sendPickle(self.__createOutputPickle(self.batch))
212 
213 
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.run (   self)

Definition at line 80 of file PostProcessingApplicationClass.py.

80  def run(self):
81  # call base class run method
82  foundation.CementApp.run(self)
83 
84  # call initialization application
85  self.__initApp()
86 
87 
88 # #load log config file
Here is the call graph for this function:

◆ setup()

def dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.setup (   self)

Definition at line 71 of file PostProcessingApplicationClass.py.

71  def setup(self):
72  # call base class setup method
73  foundation.CementApp.setup(self)
74 
75 

Member Data Documentation

◆ batch

dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.batch

Definition at line 67 of file PostProcessingApplicationClass.py.

◆ CONFIG_OPTION_LOG

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.CONFIG_OPTION_LOG = "log"
static

Definition at line 49 of file PostProcessingApplicationClass.py.

◆ configParser

dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.configParser

Definition at line 65 of file PostProcessingApplicationClass.py.

◆ exitCode

dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.exitCode

Definition at line 63 of file PostProcessingApplicationClass.py.

◆ inputFile

dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.inputFile

Definition at line 66 of file PostProcessingApplicationClass.py.

◆ logger

dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.logger

Definition at line 64 of file PostProcessingApplicationClass.py.

◆ MSG_DEBUG_INPUT_BATCH

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_DEBUG_INPUT_BATCH = "Input batch: "
static

Definition at line 42 of file PostProcessingApplicationClass.py.

◆ MSG_DEBUG_INPUT_PICKLE

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_DEBUG_INPUT_PICKLE = "Input pickle: "
static

Definition at line 41 of file PostProcessingApplicationClass.py.

◆ MSG_DEBUG_OUTPUT_BATCH

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_DEBUG_OUTPUT_BATCH = "Output batch: "
static

Definition at line 43 of file PostProcessingApplicationClass.py.

◆ MSG_DEBUG_OUTPUT_PICKLE

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_DEBUG_OUTPUT_PICKLE = "Output pickle: "
static

Definition at line 44 of file PostProcessingApplicationClass.py.

◆ MSG_DEBUG_SEND_PICKLE

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_DEBUG_SEND_PICKLE = "Send pickle. Done."
static

Definition at line 45 of file PostProcessingApplicationClass.py.

◆ MSG_ERROR_EMPTY_CONFIG_FILE_NAME

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_ERROR_EMPTY_CONFIG_FILE_NAME = "Config file name is empty."
static

Definition at line 34 of file PostProcessingApplicationClass.py.

◆ MSG_ERROR_LOAD_APP_CONFIG

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_ERROR_LOAD_APP_CONFIG = "Error loading application config file."
static

Definition at line 36 of file PostProcessingApplicationClass.py.

◆ MSG_ERROR_MISSED_SECTION

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_ERROR_MISSED_SECTION = "Missed mandatory section '%s'"
static

Definition at line 38 of file PostProcessingApplicationClass.py.

◆ MSG_ERROR_READ_LOG_CONFIG

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_ERROR_READ_LOG_CONFIG = "Error read log config file."
static

Definition at line 37 of file PostProcessingApplicationClass.py.

◆ MSG_ERROR_WRONG_CONFIG_FILE_NAME

string dc_postprocessor.PostProcessingApplicationClass.PostProcessingApplicationClass.MSG_ERROR_WRONG_CONFIG_FILE_NAME = "Config file name is wrong"
static

Definition at line 35 of file PostProcessingApplicationClass.py.


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