本文整理汇总了Python中Scheduler.Scheduler.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.initialize方法的具体用法?Python Scheduler.initialize怎么用?Python Scheduler.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scheduler.Scheduler
的用法示例。
在下文中一共展示了Scheduler.initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Scheduler import Scheduler [as 别名]
# 或者: from Scheduler.Scheduler import initialize [as 别名]
class Core:
"""
Initializes all the submodules and serves as a connection point between different modules.
"""
def __init__(self, justPlots = False):
self.__name__ = "Core"
self.configManager = ConfigurationManager()
# These return True of False depending on whether loading the conf was a success.
# It should be checked if the conf was loaded successfully and failures should be logged.
self.configManager.loadConf(CONFIG_CORE, True)
self.configManager.loadConf(CONFIG_SETTINGS, True)
self.configManager.loadConf(CONFIG_FORMS, True)
self.configManager.loadConf(CONFIG_URLMAP, True)
self.configManager.loadConf(CONFIG_MESSAGES, True)
self.moduleManager = ModuleManager(self)
self.settingsManager = SettingsManager(self)
self.clientManager = ClientManager(self)
self.sensorManager = SensorManager(self)
self.deviceManager = DeviceManager(self)
self.taskManager = TaskManager(self)
self.messageManager = MessageManager(self)
self.logging = Logging(self)
if self.settingsManager.equals("plottype", "matplotlib"):
from Plot import Plot
self.plot = Plot(self)
self.protocol = Protocol(self)
if not justPlots: self.connection = Connection(self)
if not justPlots: self.scheduler = Scheduler()
if not justPlots: self.webServer = WebServer(self.connection.getLocalIP(), self.settingsManager.getValueByName("listenport")) # Currently binds to localhost. But this needs to be fixed so other connections can be listened to too.
def initialize(self):
self.logging.logDebug(self.__name__ + "." + "initialize")
self.scheduler.initialize()
startup = Startup(self)
startup.addSensors()
startup.addDevices()
#startup.addTasks()
#startup.addSensorLogging()
#startup.addDailyPlots()
#startup.addWeeklyPlots()
#startup.addSensorControl()
#modules = []
#for moduleList in self.configManager.getConf(CONFIG_FORMS).getItem("modules", ""):
# modules.append(moduleList["module"])
self.moduleManager.loadModules(self.configManager.getConf(CONFIG_FORMS).getItem("modules", ""))
self.webServer.setUp()
def quit(self):
"""
Gives threads a signal to shut down, gives them some time to do so and then exits the program
gracefully.
"""
self.logging.logEvent("Core: Shutting down", "orange")
self.connection.running = False
sleep(1)
from os import _exit
_exit(0)