ail-framework/bin/modules/TemplateModule.py

58 lines
1.4 KiB
Python
Raw Normal View History

2018-05-04 11:53:29 +00:00
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
"""
2021-04-02 07:52:05 +00:00
The Template Module
======================
This module is a template for Template for new modules
"""
2021-04-02 07:52:05 +00:00
##################################
# Import External packages
##################################
import os
import sys
import time
2021-04-02 07:52:05 +00:00
sys.path.append(os.environ['AIL_BIN'])
2021-04-02 07:52:05 +00:00
##################################
# Import Project packages
##################################
from modules.abstract_module import AbstractModule
# from lib.objects.Items import Item
2021-04-02 07:52:05 +00:00
class Template(AbstractModule):
"""
Template module for AIL framework
"""
def __init__(self):
super(Template, self).__init__()
2023-05-30 12:48:06 +00:00
# Pending time between two computation (computeNone) in seconds, 10 by default
# self.pending_seconds = 10
2021-04-02 07:52:05 +00:00
2023-05-30 12:48:06 +00:00
# logs
2023-05-12 13:29:53 +00:00
self.logger.info(f'Module {self.module_name} initialized')
# def computeNone(self):
# """
2023-05-30 12:48:06 +00:00
# Do something when there is no message in the queue. Optional
# """
2023-05-12 13:29:53 +00:00
# self.logger.debug("No message in queue")
2021-04-02 07:52:05 +00:00
def compute(self, message):
"""
Compute a message in queue / process the message (item_id, ...)
2021-04-02 07:52:05 +00:00
"""
2023-05-12 13:29:53 +00:00
self.logger.debug("Compute message in queue")
# # if message is an item_id:
# item = Item(message)
# content = item.get_content()
2021-04-02 07:52:05 +00:00
if __name__ == '__main__':
2021-04-02 07:52:05 +00:00
module = Template()
module.run()