AIL-framework/bin/template.py

58 lines
1.2 KiB
Python
Raw Normal View History

2018-05-04 13:53:29 +02:00
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
"""
2021-04-02 09:52:05 +02:00
The Template Module
======================
This module is a template for Template for new modules
"""
2021-04-02 09:52:05 +02:00
##################################
# Import External packages
##################################
import os
import sys
import time
2021-04-02 09:52:05 +02:00
sys.path.append(os.environ['AIL_BIN'])
2021-04-02 09:52:05 +02:00
##################################
# Import Project packages
##################################
from modules.abstract_module import AbstractModule
2021-04-02 09:52:05 +02:00
class Template(AbstractModule):
"""
Template module for AIL framework
"""
def __init__(self):
super(Template, self).__init__()
# Pending time between two computation (computeNone) in seconds
2021-04-02 09:52:05 +02:00
self.pending_seconds = 10
# Send module state to logs
self.redis_logger.info(f'Module {self.module_name} initialized')
2021-04-02 09:52:05 +02:00
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")
if __name__ == '__main__':
2021-04-02 09:52:05 +02:00
module = Template()
module.run()