2 HCE project, Python bindings, Distributed Tasks Manager application. 3 Event objects definitions. 7 @author Oleksii <developers.hce@gmail.com> 8 @link: http://hierarchical-cluster-engine.com/ 9 @copyright: Copyright © 2013-2014 IOIX Ukraine 10 @license: http://hierarchical-cluster-engine.com/license/ 20 from cement.core
import foundation
39 START_APP_LOG_MSG =
"Start dtm daemon." 40 STOP_APP_LOG_MSG =
"Stop dtm daemon." 41 PID_FILE =
"../../../run/dtm-daemon.pid" 42 APP_CONFIG_FILE =
"../ini/dtm-daemon.ini" 43 LOG_CONFIG_FILE =
"../ini/dtm-daemon_log.ini" 44 LOG_MSG_START_APP =
"dtm-daemon start" 45 ERROR_LOAD_LOG_CONFIG_FILE =
"Error loading logging config file. Exiting." 46 ERROR_LOAD_CONFIG =
"Error loading config file. Exciting." 49 class DTMD(foundation.CementApp):
66 foundation.CementApp.__init__(self)
75 foundation.CementApp.setup(self)
82 foundation.CementApp.run(self)
124 app[1].setName(app[0])
125 self.
logger.debug(
"%s has been created!" % app_name)
127 except Exception
as err:
128 ExceptionLog.handler(self.
logger, err,
"Exception has been thrown during %s creation. %s" % (app_name, err.message), \
142 self.
logger.debug(
"%s waiting for stopping!" % app[0])
144 except Exception
as err:
145 ExceptionLog.handler(self.
logger, err,
"Exception has been thrown during %s joining. %s" % (app[0], err.message), \
156 app[1].setName(app[0])
158 self.
logger.debug(
"%s has been started!" % app[0])
160 except Exception
as err:
161 ExceptionLog.handler(self.
logger, err,
"Exception has been thrown during %s start. %s" % (app[0], err.message), \
170 self.
config = ConfigParser.ConfigParser()
171 self.
config.optionxform = str
172 if self.pargs.config:
173 self.
config.read(self.pargs.config)
176 self.
config.read(APP_CONFIG_FILE)
179 print ERROR_LOAD_CONFIG
187 self.
logger.debug(
"Load application's start sequence.")
188 self.
threadObjs = self.
config.get(
"Application",
"instantiateSequence").split(
",")
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)
200 print ERROR_LOAD_LOG_CONFIG_FILE
207 if self.
logger is not None:
208 self.
logger.debug(
"dtm daemon is closed")
210 foundation.CementApp.close(self)
def joinThreadObj(self, app)
def startThreadObj(self, app)
def loadLogConfigFile(self)
def loadStartAppsSequence(self)
Class hides routines of bulding connection objects.
def createThreadObj(self, app_name)