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

Classes

class  Meta
 

Public Member Functions

def __init__ (self)
 
def setup (self)
 
def run (self)
 
def createThreadObj (self, app_name)
 
def joinThreadObj (self, app)
 
def startThreadObj (self, app)
 
def loadConfig (self)
 
def loadStartAppsSequence (self)
 
def loadLogConfigFile (self)
 
def close (self, code=None)
 

Public Attributes

 logger
 
 threadObjs
 
 config
 

Static Public Attributes

int CREATE_APP_DELAY = 0
 
int START_APP_DELAY = 0
 
int JOIN_APP_DELAY = 0
 

Detailed Description

Definition at line 45 of file DCD.py.

Constructor & Destructor Documentation

◆ __init__()

def dc.DCD.DCD.__init__ (   self)

Definition at line 60 of file DCD.py.

60  def __init__(self):
61  # call base class __init__ method
62  foundation.CementApp.__init__(self)
63  self.logger = None
64  self.threadObjs = None
65 
66 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ close()

def dc.DCD.DCD.close (   self,
  code = None 
)

Definition at line 204 of file DCD.py.

204  def close(self, code=None):
205  if self.logger is not None:
206  self.logger.debug(LOG_MSG_CLOSE_APP)
207  # call base class run method
208  foundation.CementApp.close(self)
209 

◆ createThreadObj()

def dc.DCD.DCD.createThreadObj (   self,
  app_name 
)

Definition at line 119 of file DCD.py.

119  def createThreadObj(self, app_name):
120  app = None
121  try:
122  app = (app_name, eval(app_name)(self.config, ConnectionBuilderLight())) # pylint: disable = I0011, eval-used
123  app[1].setName(app[0])
124  self.logger.debug("%s has been created!", app_name)
125  time.sleep(self.CREATE_APP_DELAY)
126  except:
127  self.logger.error("Exception has been thrown during %s creation!", app_name)
128  raise
129  return app
130 
131 
-mask-info
Here is the caller graph for this function:

◆ joinThreadObj()

def dc.DCD.DCD.joinThreadObj (   self,
  app 
)

Definition at line 137 of file DCD.py.

137  def joinThreadObj(self, app):
138  try:
139  app[1].join()
140  self.logger.debug("%s waiting for stopping!", app[0])
141  time.sleep(self.JOIN_APP_DELAY)
142  except:
143  self.logger.error("Exception has been thrown during %s joining!", app[0])
144  raise
145 
146 
-mask-info
Definition: join.py:1
Here is the caller graph for this function:

◆ loadConfig()

def dc.DCD.DCD.loadConfig (   self)

Definition at line 164 of file DCD.py.

164  def loadConfig(self):
165  try:
166  self.config = ConfigParser.ConfigParser()
167  self.config.optionxform = str
168  if self.pargs.config:
169  self.config.read(self.pargs.config)
170  else:
171  raise Exception("Error load config")
172  # self.config.read(APP_CONFIG_FILE)
173  except Exception as err:
174  print ERROR_LOAD_CONFIG + err.message
175  raise
176 
177 
Here is the caller graph for this function:

◆ loadLogConfigFile()

def dc.DCD.DCD.loadLogConfigFile (   self)

Definition at line 189 of file DCD.py.

189  def loadLogConfigFile(self):
190  try:
191  log_conf_file = self.config.get("Application", "log")
192  logging.config.fileConfig(log_conf_file)
193  #self.logger = logging.getLogger(APP_NAME)
194  # Logger initialization
195  self.logger = logging.getLogger(APP_CONSTS.LOGGER_NAME)
196 
197  except Exception as err:
198  print ERROR_LOAD_LOG_CONFIG_FILE + err.message
199  raise
200 
201 
Here is the caller graph for this function:

◆ loadStartAppsSequence()

def dc.DCD.DCD.loadStartAppsSequence (   self)

Definition at line 181 of file DCD.py.

181  def loadStartAppsSequence(self):
182  self.logger.debug("Load application's start sequence.")
183  self.threadObjs = self.config.get("Application", "instantiateSequence").split(",")
184 
185 
Here is the caller graph for this function:

◆ run()

def dc.DCD.DCD.run (   self)

Definition at line 76 of file DCD.py.

76  def run(self):
77  # call base class run method
78  foundation.CementApp.run(self)
79 
80  # config section
81  self.loadConfig()
82 
83  # load logger config file
84  self.loadLogConfigFile()
85 
86  # load application sequence
87  self.loadStartAppsSequence()
88 
89  # create threadObjs
90  # strictly ordered sequence caused connection establishment order
91  try:
92  self.threadObjs = [self.createThreadObj(threadObj) for threadObj in self.threadObjs]
93  except:
94  self.logger.error("Exception during creation thread-based class!\n" + Utils.getTracebackInfo())
95  raise
96 
97  # run apps
98  # strictly ordered
99  try:
100  [self.startThreadObj(threadObj) for threadObj in self.threadObjs]
101  except:
102  self.logger.error("Exception during run thread-based class!\n" + Utils.getTracebackInfo())
103  raise
104 
105  # wait for stop
106  # strictly ordered
107  try:
108  [self.joinThreadObj(threadObj) for threadObj in self.threadObjs]
109  except:
110  self.logger.error("Exception during stop thread-based class!\n" + Utils.getTracebackInfo())
111  raise
112 
113 
-mask-info
Here is the call graph for this function:

◆ setup()

def dc.DCD.DCD.setup (   self)

Definition at line 69 of file DCD.py.

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

◆ startThreadObj()

def dc.DCD.DCD.startThreadObj (   self,
  app 
)

Definition at line 151 of file DCD.py.

151  def startThreadObj(self, app):
152  try:
153  app[1].setName(app[0])
154  app[1].start()
155  self.logger.debug("%s has been started!", app[0])
156  time.sleep(self.START_APP_DELAY)
157  except:
158  self.logger.error("Exception has been thrown during %s start!", app[0])
159  raise
160 
161 
-mask-info
Here is the caller graph for this function:

Member Data Documentation

◆ config

dc.DCD.DCD.config

Definition at line 166 of file DCD.py.

◆ CREATE_APP_DELAY

int dc.DCD.DCD.CREATE_APP_DELAY = 0
static

Definition at line 47 of file DCD.py.

◆ JOIN_APP_DELAY

int dc.DCD.DCD.JOIN_APP_DELAY = 0
static

Definition at line 49 of file DCD.py.

◆ logger

dc.DCD.DCD.logger

Definition at line 63 of file DCD.py.

◆ START_APP_DELAY

int dc.DCD.DCD.START_APP_DELAY = 0
static

Definition at line 48 of file DCD.py.

◆ threadObjs

dc.DCD.DCD.threadObjs

Definition at line 64 of file DCD.py.


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