-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo_mysql.py
executable file
·41 lines (32 loc) · 1001 Bytes
/
demo_mysql.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
# -*- encoding: utf-8 -*-
"""
@File : demo_mysql.py
@Time : 2019/10/15 2:40 PM
@Author : slyu
@Email : [email protected]
@Software: PyCharm
"""
import os
from multiprocessing import Process
from code_task.consume_task import Consume
from code_task.download_task import DownLoad
from code_task.init_task import InitialPackage
def create_init_dir():
path_to_task = "./task/"
if not os.path.isdir(path_to_task):
os.mkdir(path_to_task)
path_to_watch = "./download/"
if not os.path.isdir(path_to_watch):
os.mkdir(path_to_watch)
if __name__ == "__main__":
create_init_dir()
InitialPackage().process("mysql")
# 获取更新包下载链接 并下载压缩包
download_task = Process(target=DownLoad().run)
download_task.daemon = True
download_task.start()
# 顺序消费入库
consume_task = Process(target=Consume().run, args=("mysql",))
consume_task.daemon = True
consume_task.start()
download_task.join()