import asyncio import time from cpl.core.console import Console from cpl.dependency.hosted.hosted_service import HostedService class Hosted(HostedService): def __init__(self): self._stopped = False async def start(self): Console.write_line("Hosted Service Started") while not self._stopped: Console.write_line("Hosted Service Running") await asyncio.sleep(5) async def stop(self): Console.write_line("Hosted Service Stopped") self._stopped = True