-
Notifications
You must be signed in to change notification settings - Fork 135
/
run_api.py
78 lines (73 loc) · 1.93 KB
/
run_api.py
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import uvicorn
import threading
import solidgpt.src.api.api
import celery.fixups
import kombu.transport.sqlalchemy
import celery.fixups.django
import celery.app.amqp
import celery.backends
import celery.backends.redis
from celery import Celery
# PyInstaller friendly imports --start--
import celery.app.amqp
import celery.app.log
import celery.worker.autoscale
import celery.worker.components
import celery.bin
import celery.utils
import celery.utils.dispatch
import celery.contrib.testing
import celery.utils.static
import celery.concurrency.prefork
import celery.app.events
import celery.events.state
import celery.app.control
import celery.backends.redis
import celery.backends
import celery.backends.database
import celery.worker
import celery.worker.consumer
import celery.app
import celery.loaders
import celery.security
import celery.fixups
import celery.concurrency
import celery.concurrency.thread
import celery.events
import celery.contrib
import celery.apps
import celery
import celery.fixups
import celery.fixups.django
import celery.apps.worker
import celery.worker.strategy
import kombu.transport.redis
import sqlalchemy.sql.default_comparator
import sqlalchemy.ext.baked
import subprocess
import platform
if __name__ == "__main__":
# Define the Celery command as a list of strings
celery_command = []
if platform.system() == 'Windows':
celery_command = [
'celery',
'-A',
'solidgpt.src.api.celery_tasks',
'worker',
'--loglevel=info',
'-P',
'eventlet'
]
else:
celery_command = [
'celery',
'-A',
'solidgpt.src.api.celery_tasks',
'worker',
'--loglevel=info'
]
# Start the Celery worker process in the background
#celery_process = subprocess.Popen(celery_command)
# Run your UVicorn server
uvicorn.run("solidgpt.src.api.api:app", port=8000)