Addition of start_event.set() makes Indefinite service to stop
andrewshvv opened this issue · 1 comments
andrewshvv commented
Is this an expected behavior that the program does finish?
aiomisc 17.3.2
Conda Python 3.9.17
Apple M1 Max
Example from doc
import asyncio
from random import random, randint
from aiomisc import entrypoint, get_context, Service
class LoggingService(Service):
async def start(self):
context = get_context()
wait_time = await context['wait_time']
print('Wait time is', wait_time)
self.start_event.set()
while True:
print('Hello from service', self.name)
await asyncio.sleep(wait_time)
class RemoteConfiguration(Service):
async def start(self):
# querying from remote server
await asyncio.sleep(random())
self.context['wait_time'] = randint(1, 5)
services = (
LoggingService(name='#1'),
LoggingService(name='#2'),
LoggingService(name='#3'),
RemoteConfiguration()
)
with entrypoint(*services) as loop:
pass
Console output
Intel MKL WARNING: Support of Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled only processors has been deprecated. Intel oneAPI Math Kernel Library 2025.0 will require Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.
Intel MKL WARNING: Support of Intel(R) Streaming SIMD Extensions 4.2 (Intel(R) SSE4.2) enabled only processors has been deprecated. Intel oneAPI Math Kernel Library 2025.0 will require Intel(R) Advanced Vector Extensions (Intel(R) AVX) instructions.
Wait time is 4
Hello from service #1
Wait time is 4
Hello from service #3
Wait time is 4
Hello from service #2
Process finished with exit code 0
andrewshvv commented
I am dumb
loop.run_forever()