2021-12-01 14:27:49 +08:00
|
|
|
"""
|
|
|
|
Author : XinYi Song
|
|
|
|
Time : 2021/11/23 9:47
|
|
|
|
Desc:
|
|
|
|
"""
|
|
|
|
from flask import Flask
|
|
|
|
from flask_apscheduler import APScheduler
|
|
|
|
|
|
|
|
scheduler = APScheduler()
|
|
|
|
|
|
|
|
|
|
|
|
def create_app():
|
|
|
|
app = Flask(__name__)
|
|
|
|
# 配置任务,不然无法启动任务
|
|
|
|
app.config.update(
|
|
|
|
{
|
|
|
|
"SCHEDULER_API_ENABLED": True,
|
|
|
|
"SCHEDULER_TIMEZONE": "Asia/Shanghai",
|
|
|
|
"JOBS": [
|
|
|
|
{
|
|
|
|
"id": "my_job", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_VJ102_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
|
|
|
"seconds": 2 * 60 # 时间间隔
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job2", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_VJ103_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
|
|
|
"seconds": 3 * 60 # 时间间隔
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job3", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_GF3MDJ_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 5 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job4", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_H08_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 7 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job5", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_Sentinel1_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 11 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job6", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_Sentinel2_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 8 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
},
|
2021-12-03 17:33:02 +08:00
|
|
|
# {
|
|
|
|
# "id": "job7", # 任务ID
|
|
|
|
# "func": "util:scan_file_util.scan_Sentinel3OL_dir", # 任务位置
|
|
|
|
# "trigger": "interval", # 触发器
|
|
|
|
# "seconds": 5 * 60 # 时间间隔
|
|
|
|
# },
|
2021-12-01 14:27:49 +08:00
|
|
|
{
|
|
|
|
"id": "job8", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_HJ1_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 5 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job9", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_ZY3_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 5 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "job10", # 任务ID
|
|
|
|
"func": "util:scan_file_util.scan_SNPP_dir", # 任务位置
|
|
|
|
"trigger": "interval", # 触发器
|
2021-12-03 17:33:02 +08:00
|
|
|
"seconds": 5 * 60 # 时间间隔
|
2021-12-01 14:27:49 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
)
|
|
|
|
scheduler.init_app(app)
|
|
|
|
scheduler.start()
|
|
|
|
return app
|