-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update phone_sensors settings and schemas
- Loading branch information
1 parent
2e4dabb
commit b51e382
Showing
6 changed files
with
78 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Main entry point for the application.""" | ||
|
||
from multiprocessing import Process | ||
|
||
import rich | ||
import uvicorn | ||
from rq.worker_pool import WorkerPool | ||
from sqlalchemy import create_engine | ||
|
||
from phone_sensors.api import app | ||
from phone_sensors.db import init_db | ||
from phone_sensors.settings import get_redis_connection, get_settings | ||
|
||
|
||
def main(): | ||
settings = get_settings() | ||
rich.print(settings) | ||
engine = create_engine(str(settings.postgres_dsn)) | ||
init_db(engine) | ||
api_process = Process( | ||
target=uvicorn.run, args=(app,), kwargs={"host": settings.host, "port": settings.port} | ||
) | ||
worker_pool_process = Process( | ||
target=WorkerPool( | ||
["default", "high", "low"], num_workers=3, connection=next(get_redis_connection()) | ||
).start | ||
) | ||
api_process.start() | ||
worker_pool_process.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters