2018-05-04 11:53:29 +00:00
|
|
|
#!/usr/bin/env python3
|
2016-02-03 09:33:42 +00:00
|
|
|
# -*-coding:UTF-8 -*
|
|
|
|
"""
|
2021-04-02 07:52:05 +00:00
|
|
|
The Template Module
|
|
|
|
======================
|
|
|
|
|
|
|
|
This module is a template for Template for new modules
|
|
|
|
|
2016-02-03 09:33:42 +00:00
|
|
|
"""
|
|
|
|
|
2021-04-02 07:52:05 +00:00
|
|
|
##################################
|
|
|
|
# Import External packages
|
|
|
|
##################################
|
2016-02-03 09:33:42 +00:00
|
|
|
import time
|
|
|
|
from pubsublogger import publisher
|
|
|
|
|
2021-04-02 07:52:05 +00:00
|
|
|
|
|
|
|
##################################
|
|
|
|
# Import Project packages
|
|
|
|
##################################
|
|
|
|
from module.abstract_module import AbstractModule
|
2016-02-03 09:33:42 +00:00
|
|
|
from Helper import Process
|
|
|
|
|
|
|
|
|
2021-04-02 07:52:05 +00:00
|
|
|
class Template(AbstractModule):
|
|
|
|
"""
|
|
|
|
Template module for AIL framework
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(Template, self).__init__()
|
|
|
|
|
|
|
|
# Send module state to logs
|
|
|
|
self.redis_logger.info("Module %s initialized"%(self.module_name))
|
|
|
|
|
|
|
|
# Pending time between two computation in seconds
|
|
|
|
self.pending_seconds = 10
|
|
|
|
|
|
|
|
|
|
|
|
def computeNone(self):
|
|
|
|
"""
|
|
|
|
Compute when no message in queue
|
|
|
|
"""
|
|
|
|
self.redis_logger.debug("No message in queue")
|
|
|
|
|
|
|
|
|
|
|
|
def compute(self, message):
|
|
|
|
"""
|
|
|
|
Compute a message in queue
|
|
|
|
"""
|
|
|
|
self.redis_logger.debug("Compute message in queue")
|
|
|
|
|
2016-02-03 09:33:42 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-04-02 07:52:05 +00:00
|
|
|
|
|
|
|
module = Template()
|
|
|
|
module.run()
|