Juan Pablo Giménez 5 лет назад
Родитель
Сommit
79520bda7a
1 измененных файлов: 12 добавлений и 12 удалений
  1. +12
    -12
      modules/core/core.py

+ 12
- 12
modules/core/core.py Просмотреть файл

@@ -83,7 +83,7 @@ class SensorAPI(object):
def init_sensors(self): def init_sensors(self):
''' '''
Initialize all sensors Initialize all sensors
:return:
:return:
''' '''


self.app.logger.info("Init Sensors") self.app.logger.info("Init Sensors")
@@ -108,15 +108,15 @@ class SensorAPI(object):
def init_sensor(self, id): def init_sensor(self, id):
''' '''
initialize sensor by id initialize sensor by id
:param id:
:return:
:param id:
:return:
''' '''


def start_active_sensor(instance): def start_active_sensor(instance):
''' '''
start active sensors as background job start active sensors as background job
:param instance:
:return:
:param instance:
:return:
''' '''
instance.execute() instance.execute()


@@ -447,12 +447,12 @@ class CraftBeerPi(ActorAPI, SensorAPI):
def run_init(self): def run_init(self):
''' '''
call all initialziers after startup call all initialziers after startup
:return:
:return:
''' '''
self.app.logger.info("Invoke Init") self.app.logger.info("Invoke Init")
self.cache["init"] = sorted(self.cache["init"], key=lambda k: k['order']) self.cache["init"] = sorted(self.cache["init"], key=lambda k: k['order'])
for i in self.cache.get("init"): for i in self.cache.get("init"):
self.app.logger.info("INITIALIZER - METHOD %s PAHT %s: " % (i.get("function").__name__, str(inspect.getmodule(i.get("function")).__file__) ))
self.app.logger.info("INITIALIZER - METHOD %s PATH %s: " % (i.get("function").__name__, str(inspect.getmodule(i.get("function")).__file__) ))
i.get("function")(self) i.get("function")(self)




@@ -461,10 +461,10 @@ class CraftBeerPi(ActorAPI, SensorAPI):


''' '''
Background Task Decorator Background Task Decorator
:param key:
:param interval:
:param config_parameter:
:return:
:param key:
:param interval:
:param config_parameter:
:return:
''' '''
def real_decorator(function): def real_decorator(function):
self.cache["background"].append({"function": function, "key": key, "interval": interval, "config_parameter": config_parameter}) self.cache["background"].append({"function": function, "key": key, "interval": interval, "config_parameter": config_parameter})
@@ -476,7 +476,7 @@ class CraftBeerPi(ActorAPI, SensorAPI):
def run_background_processes(self): def run_background_processes(self):
''' '''
call all background task after startup call all background task after startup
:return:
:return:
''' '''
self.app.logger.info("Start Background") self.app.logger.info("Start Background")




Загрузка…
Отмена
Сохранить