def __init__(self, taskName, config, appDir=None): """ Init task class. @param taskName: @param config: @param appDir: @return: """ self.application = application() self.name = taskName self.config = config self.taskType = self.getTaskType(self.config) self.cronValue = self.getConfigParam('task.cron') version = self.getConfigParam('task.version') if version: self.version = version self.maxExecutionTime = self.getConfigParam('task.maxExecutionTime') self.workDir = self.getTaskServiceDir('workDir') self.prepareEnvironment(self.workDir) self.statusDir = self.getTaskServiceDir('statusDir') self.prepareEnvironment(self.statusDir) self.lockFile = self.statusDir + os.sep + '.run' self.statusFile = self.statusDir + os.sep + '.status'
def appConfigure(self): self.app = application() self.app.setup() self.app.config = configBuilder(self.app.appDir + os.sep + "config") self.app.config.buildHostConfig(getSubnet(), getIp())
# -*- coding: utf-8 -*- """ main module. """ from components.application import application if __name__ == '__main__': app = application() app.setup() app.run()