-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_global_copy.py
47 lines (29 loc) · 983 Bytes
/
init_global_copy.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
import time
from concurrent.futures.thread import ThreadPoolExecutor
import docker
import pymysql
from settings import Config
def init():
class GlobalV:
db: pymysql.connections.Connection
dc: docker.client.DockerClient
threads_pool: ThreadPoolExecutor
g = GlobalV()
def __init__(self):
host = "47.94.199.65"
self.db_pool = pymysql.connect(host=host, database='coco', autocommit=True, user=Config.sql_user,
password=Config.sql_password,
charset="utf8", )
dc = docker.from_env()
threads_pool = ThreadPoolExecutor(max_workers=35)
async def job():
time.sleep(5)
print('hi')
# loop=asyncio.new_event_loop()
# asyncIO_scheduler = AsyncIOScheduler(event_loop=loop)
# asyncIO_scheduler.start()
# loop.run_forever()
# asyncIO_scheduler = AsyncIOScheduler()
# # scheduler.add_job(job, "interval", seconds=3)
# asyncIO_scheduler.start()
# asyncio.get_event_loop().run_forever()