35 lines
788 B
Python
35 lines
788 B
Python
"""排队进程:从 NQI、FTP/SFTP 采集入库,并导出结果文件。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.bootstrap import init_db
|
|
from app.collect.accounts import reset_active_tasks
|
|
from app.config import postgres_conninfo
|
|
from app.runtime import start_background
|
|
|
|
|
|
def main() -> None:
|
|
import asyncio
|
|
import logging
|
|
import sys
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
if sys.platform == "win32":
|
|
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
|
ready = init_db()
|
|
reset_active_tasks()
|
|
start_background()
|
|
import time
|
|
|
|
while not postgres_conninfo():
|
|
time.sleep(2)
|
|
if not ready:
|
|
init_db()
|
|
from app.tasks.queue import serve
|
|
|
|
serve()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|