archive
/
actioner
Archived
1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
actioner/actioner/main.py

28 lines
781 B
Python
Raw Normal View History

import logging
2019-02-14 14:27:04 +00:00
from multiprocessing import Process
2019-02-17 17:14:17 +00:00
import sentry_sdk
2019-02-14 14:27:04 +00:00
from aiohttp.web import run_app as run_web_app
2019-02-22 22:31:25 +00:00
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
2019-02-14 14:27:04 +00:00
2019-08-30 19:33:32 +01:00
from actioner.scheduler import create_scheduler
2019-02-17 17:14:17 +00:00
from actioner.settings import LOGGING_LEVEL, SENTRY_DSN
2019-02-14 14:27:04 +00:00
from actioner.web import get_server
2019-02-14 14:27:04 +00:00
2019-02-14 13:45:46 +00:00
def main():
logging.basicConfig(level=LOGGING_LEVEL)
2019-02-14 19:37:17 +00:00
2019-02-22 22:36:17 +00:00
sentry_sdk.init(dsn=SENTRY_DSN, integrations=[AioHttpIntegration()])
2019-02-17 17:14:17 +00:00
2019-02-14 14:27:04 +00:00
server = get_server()
2019-02-14 19:37:17 +00:00
scheduler = create_scheduler()
# HACK: APScheduler doesn't like running in an external event loop. https://github.com/agronholm/apscheduler/issues/360
2019-02-14 19:37:17 +00:00
Process(target=run_web_app, args=(server,)).start()
2019-08-30 19:33:32 +01:00
Process(target=scheduler.start).start()
2019-02-14 13:45:46 +00:00
2019-02-22 22:36:17 +00:00
if __name__ == "__main__":
2019-02-14 13:45:46 +00:00
main()