-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
42 lines (29 loc) · 1005 Bytes
/
run.py
File metadata and controls
42 lines (29 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import uvicorn
from main import app
original_callback = uvicorn.main.callback
def callback(**kwargs):
from celery.contrib.testing.worker import start_worker
import tasks
with start_worker(tasks.task, perform_ping_check=False, loglevel="info"):
original_callback(**kwargs)
uvicorn.main.callback = callback
if __name__ == "__main__":
import os
import sys
import threading
import multiprocessing
# Execute redis-server
redis = threading.Thread(target=os.system, args=('redis-server', ))
redis.start()
celery_schedule = multiprocessing.Process(target=os.system,
args=('celery -A tasks beat', ))
celery_schedule.start()
frontend = multiprocessing.Process(
target=os.system, args=('cd auth-front-end && npm run dev', ))
frontend.start()
# uvicorn filename:app
sys.argv += ['main_oauth2:app', '--reload', '--host=0.0.0.0', '--port=3000']
uvicorn.main()
redis.join()
celery_schedule.join()
frontend.join()