Fix: Stopping the core didn't stop the scheduler in latest aiohttp release
@@ -24,7 +24,7 @@ _LOGGER = logger.setup(__name__) # logging.Logger
class Server:
- """Core server"""
+ """FOGLamp core server. Starts the FogLAMP scheduler and the FogLAMP REST server."""
"""Class attributes"""
scheduler = None
@@ -50,7 +50,6 @@ class Server:
def start(cls):
"""Starts the server"""
loop = asyncio.get_event_loop()
- loop.run_until_complete(asyncio.ensure_future(cls._start_scheduler()))
# Register signal handlers
# Registering SIGTERM creates an error at shutdown. See
@@ -60,8 +59,11 @@ class Server:
signal_name,
lambda: asyncio.ensure_future(cls._stop(loop)))
+ # The scheduler must start first because the REST API interacts with it
+ loop.run_until_complete(asyncio.ensure_future(cls._start_scheduler()))
+
# https://aiohttp.readthedocs.io/en/stable/_modules/aiohttp/web.html#run_app
- web.run_app(cls._make_app(), host='0.0.0.0', port=8082)
+ web.run_app(cls._make_app(), host='0.0.0.0', port=8082, handle_signals=False)
@classmethod
async def _stop(cls, loop):
