28 lines
684 B
Python
28 lines
684 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""Test service to validate the setup"""
|
||
|
|
import asyncio
|
||
|
|
import sys
|
||
|
|
sys.path.insert(0, '/mnt/dolphinng5_predict/prod')
|
||
|
|
|
||
|
|
from services.service_base import ServiceBase
|
||
|
|
|
||
|
|
class TestService(ServiceBase):
|
||
|
|
def __init__(self):
|
||
|
|
super().__init__(
|
||
|
|
name='test',
|
||
|
|
check_interval=5,
|
||
|
|
max_retries=3,
|
||
|
|
notify_systemd=True
|
||
|
|
)
|
||
|
|
self.counter = 0
|
||
|
|
|
||
|
|
async def run_cycle(self):
|
||
|
|
self.counter += 1
|
||
|
|
self.logger.info(f"Test cycle {self.counter}")
|
||
|
|
await asyncio.sleep(2)
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
print("Starting test service...")
|
||
|
|
service = TestService()
|
||
|
|
service.run()
|