2018-05-04 13:53:29 +02:00
|
|
|
#!/usr/bin/env python3
|
2016-02-03 10:33:42 +01:00
|
|
|
# -*-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-06-08 16:46:36 +02:00
|
|
|
|
2016-02-03 10:33:42 +01:00
|
|
|
"""
|
|
|
|
|
2021-04-02 09:52:05 +02:00
|
|
|
##################################
|
|
|
|
# Import External packages
|
|
|
|
##################################
|
2021-06-08 16:46:36 +02:00
|
|
|
import os
|
|
|
|
import sys
|
2016-02-03 10:33:42 +01:00
|
|
|
import time
|
2021-04-02 09:52:05 +02:00
|
|
|
|
2021-06-08 16:46:36 +02:00
|
|
|
sys.path.append(os.environ['AIL_BIN'])
|
2021-04-02 09:52:05 +02:00
|
|
|
##################################
|
|
|
|
# Import Project packages
|
|
|
|
##################################
|
2021-06-08 16:46:36 +02:00
|
|
|
from modules.abstract_module import AbstractModule
|
2022-10-25 16:25:19 +02:00
|
|
|
# from lib.objects.Items import Item
|
2016-02-03 10:33:42 +01:00
|
|
|
|
2021-04-02 09:52:05 +02:00
|
|
|
class Template(AbstractModule):
|
|
|
|
"""
|
|
|
|
Template module for AIL framework
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(Template, self).__init__()
|
|
|
|
|
2021-06-08 16:46:36 +02:00
|
|
|
# Pending time between two computation (computeNone) in seconds
|
2021-04-02 09:52:05 +02:00
|
|
|
self.pending_seconds = 10
|
|
|
|
|
2021-06-08 16:46:36 +02:00
|
|
|
# Send module state to logs
|
2023-05-12 15:29:53 +02:00
|
|
|
self.logger.info(f'Module {self.module_name} initialized')
|
2021-06-08 16:46:36 +02:00
|
|
|
|
2023-01-18 16:28:08 +01:00
|
|
|
# def computeNone(self):
|
|
|
|
# """
|
|
|
|
# Do something when there is no message in the queue
|
|
|
|
# """
|
2023-05-12 15:29:53 +02:00
|
|
|
# self.logger.debug("No message in queue")
|
2021-04-02 09:52:05 +02:00
|
|
|
|
|
|
|
def compute(self, message):
|
|
|
|
"""
|
2022-10-25 16:25:19 +02:00
|
|
|
Compute a message in queue / process the message (item_id, ...)
|
2021-04-02 09:52:05 +02:00
|
|
|
"""
|
2023-05-12 15:29:53 +02:00
|
|
|
self.logger.debug("Compute message in queue")
|
2022-10-25 16:25:19 +02:00
|
|
|
# # if message is an item_id:
|
|
|
|
# item = Item(message)
|
|
|
|
# content = item.get_content()
|
2021-04-02 09:52:05 +02:00
|
|
|
|
2016-02-03 10:33:42 +01:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-06-08 16:46:36 +02:00
|
|
|
|
2021-04-02 09:52:05 +02:00
|
|
|
module = Template()
|
|
|
|
module.run()
|