def run(self): globalProperty.restAdminInstance = self self.__worker = globalProperty.getRestWorkerInstance() self.__schMgr = globalProperty.getRestSchTkMgrInstance() #Start Scheduling Job self.__startSchedule() #Start Worker self.__startWorker() self.__machineAnswer = machineAnswer() self.__machineAnswer.setDaemon(False) self.__machineAnswer.start() self.__remoteListener = remoteListener() self.__remoteListener.setDaemon(False) self.__remoteListener.start() self.__policyServer = policyServer() self.__policyServer.setDaemon(False) self.__policyServer.start() self.__loadRestModules() self.__start_listen() time.sleep(5)
def __init__(self): Thread.__init__(self) self.__qmsWS = QMSWebService() self.__macAddress = globalProperty.getMacAddress() self.setName("remoteListener") self.__status=self.getConnectStatus() self.updateStatus(self.__status) self.__statusChange=False self.__worker = globalProperty.getRestWorkerInstance()
def __init__(self, host='', port=21889, bufsiz=1024): Thread.__init__(self) self.setName("policyAnswer") self.__worker = globalProperty.getRestWorkerInstance() self.__schMgr = globalProperty.getRestSchTkMgrInstance() self.__host = host self.__port = port self.__bufsiz = bufsiz self.__tcpSerSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__tcpSerSock.bind((host, port)) self.__tcpSerSock.listen(5)
def __init__(self, type, overdueDir, scheduleDir, tasklist=[], timeTactic=[0, 0, 0], repeat=True): self.logger = logging.getLogger() self.logger.info("-----Generete a new Type Manager:" + type) self._worker = globalProperty.getRestWorkerInstance() self._dbutil = globalProperty.getDbUtil() self.type = type self.overdueDir = overdueDir self.scheduleDir = scheduleDir self.tasklist = tasklist self.timeSpaceHolder = ["0", "0", "0"] * 3 self.timeTactic = timeTactic self.repeat = repeat self.__timerDic = {}
def isDoing(self, task): return globalProperty.getRestWorkerInstance().getPendingTaskFileName() == task['fileName']