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

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)
 

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 49 of file DTMD.py.

Constructor & Destructor Documentation

◆ __init__()

def dtm.DTMD.DTMD.__init__ (   self)

Definition at line 64 of file DTMD.py.

64  def __init__(self):
65  # call base class __init__ method
66  foundation.CementApp.__init__(self)
67  self.logger = None
68  self.threadObjs = None
69 
70 
def __init__(self)
constructor
Definition: UIDGenerator.py:19

Member Function Documentation

◆ close()

def dtm.DTMD.DTMD.close (   self)

Definition at line 206 of file DTMD.py.

206  def close(self):
207  if self.logger is not None:
208  self.logger.debug("dtm daemon is closed")
209  # call base class run method
210  foundation.CementApp.close(self)
211 

◆ createThreadObj()

def dtm.DTMD.DTMD.createThreadObj (   self,
  app_name 
)

Definition at line 120 of file DTMD.py.

120  def createThreadObj(self, app_name):
121  app = None
122  try:
123  app = (app_name, eval(app_name)(self.config, ConnectionBuilderLight())) # pylint: disable=W0123
124  app[1].setName(app[0])
125  self.logger.debug("%s has been created!" % app_name)
126  time.sleep(self.CREATE_APP_DELAY)
127  except Exception as err:
128  ExceptionLog.handler(self.logger, err, "Exception has been thrown during %s creation. %s" % (app_name, err.message), \
129  (err))
130  raise
131  return app
132 
133 
Here is the caller graph for this function:

◆ joinThreadObj()

def dtm.DTMD.DTMD.joinThreadObj (   self,
  app 
)

Definition at line 139 of file DTMD.py.

139  def joinThreadObj(self, app):
140  try:
141  app[1].join()
142  self.logger.debug("%s waiting for stopping!" % app[0])
143  time.sleep(self.JOIN_APP_DELAY)
144  except Exception as err:
145  ExceptionLog.handler(self.logger, err, "Exception has been thrown during %s joining. %s" % (app[0], err.message), \
146  (err))
147  raise
148 
149 
Definition: join.py:1

◆ loadConfig()

def dtm.DTMD.DTMD.loadConfig (   self)

Definition at line 168 of file DTMD.py.

168  def loadConfig(self):
169  try:
170  self.config = ConfigParser.ConfigParser()
171  self.config.optionxform = str
172  if self.pargs.config:
173  self.config.read(self.pargs.config)
174  # self.logger.debug("Load config from cli argument: " + self.pargs.config)
175  else:
176  self.config.read(APP_CONFIG_FILE)
177  # self.logger.debug("Load config from default config file: " + APP_CONFIG_FILE)
178  except:
179  print ERROR_LOAD_CONFIG
180  raise
181 
182 
Here is the caller graph for this function:

◆ loadLogConfigFile()

def dtm.DTMD.DTMD.loadLogConfigFile (   self)

Definition at line 194 of file DTMD.py.

194  def loadLogConfigFile(self):
195  try:
196  log_conf_file = self.config.get("Application", "log")
197  logging.config.fileConfig(log_conf_file)
198  self.logger = logging.getLogger(DTM_CONSTS.LOGGER_NAME)
199  except:
200  print ERROR_LOAD_LOG_CONFIG_FILE
201  raise
202 
203 
Here is the caller graph for this function:

◆ loadStartAppsSequence()

def dtm.DTMD.DTMD.loadStartAppsSequence (   self)

Definition at line 186 of file DTMD.py.

186  def loadStartAppsSequence(self):
187  self.logger.debug("Load application's start sequence.")
188  self.threadObjs = self.config.get("Application", "instantiateSequence").split(",")
189 
190 
Here is the caller graph for this function:

◆ run()

def dtm.DTMD.DTMD.run (   self)

Definition at line 80 of file DTMD.py.

80  def run(self):
81  # call base class run method
82  foundation.CementApp.run(self)
83 
84  # config section
85  self.loadConfig()
86 
87  # load self.logger config file
88  self.loadLogConfigFile()
89 
90  # load application sequence
91  self.loadStartAppsSequence()
92 
93  # create threadObjs
94  # strictly ordered sequence caused connection establishment order
95  try:
96  self.threadObjs = [self.createThreadObj(app_name) for app_name in self.threadObjs]
97  except:
98  raise
99 
100  # run apps
101  # strictly ordered
102  try:
103  [self.startThreadObj(app) for app in self.threadObjs]
104  except:
105  raise
106 
107  # wait for stop
108  # strictly ordered
109  # try:
110  # [self.joinThreadObj(app) for app in self.threadObjs]
111  # except:
112  # raise
113 
114 
Here is the call graph for this function:

◆ setup()

def dtm.DTMD.DTMD.setup (   self)

Definition at line 73 of file DTMD.py.

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

◆ startThreadObj()

def dtm.DTMD.DTMD.startThreadObj (   self,
  app 
)

Definition at line 154 of file DTMD.py.

154  def startThreadObj(self, app):
155  try:
156  app[1].setName(app[0])
157  app[1].start()
158  self.logger.debug("%s has been started!" % app[0])
159  time.sleep(self.START_APP_DELAY)
160  except Exception as err:
161  ExceptionLog.handler(self.logger, err, "Exception has been thrown during %s start. %s" % (app[0], err.message), \
162  (err))
163  raise
164 
165 
Here is the caller graph for this function:

Member Data Documentation

◆ config

dtm.DTMD.DTMD.config

Definition at line 170 of file DTMD.py.

◆ CREATE_APP_DELAY

int dtm.DTMD.DTMD.CREATE_APP_DELAY = 0
static

Definition at line 51 of file DTMD.py.

◆ JOIN_APP_DELAY

int dtm.DTMD.DTMD.JOIN_APP_DELAY = 0
static

Definition at line 53 of file DTMD.py.

◆ logger

dtm.DTMD.DTMD.logger

Definition at line 67 of file DTMD.py.

◆ START_APP_DELAY

int dtm.DTMD.DTMD.START_APP_DELAY = 0
static

Definition at line 52 of file DTMD.py.

◆ threadObjs

dtm.DTMD.DTMD.threadObjs

Definition at line 68 of file DTMD.py.


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