为WinSW做准备

This commit is contained in:
Neo
2025-11-19 05:05:11 +08:00
parent 821d302243
commit cbe48c8ee7
4 changed files with 50 additions and 0 deletions

9
app/etl_busy.py Normal file
View File

@@ -0,0 +1,9 @@
# app/etl_busy.py
def run():
"""
忙时抓取逻辑。
TODO: 这里写具体抓取流程API 调用 / 网页解析 / 写入 PostgreSQL 等)
"""
print("Running busy-period ETL...")
# 示例:后续在这里接 PostgreSQL 或 HTTP 抓取
# ...

8
app/etl_idle.py Normal file
View File

@@ -0,0 +1,8 @@
# app/etl_idle.py
def run():
"""
闲时抓取逻辑。
可以做全量同步、大批量历史修正等。
"""
print("Running idle-period ETL...")
# ...

31
app/runner.py Normal file
View File

@@ -0,0 +1,31 @@
# app/runner.py
import argparse
from datetime import datetime
from . import etl_busy, etl_idle
def main():
parser = argparse.ArgumentParser(description="Feiqiu ETL Runner")
parser.add_argument(
"--mode",
choices=["busy", "idle"],
required=True,
help="ETL mode: busy or idle",
)
args = parser.parse_args()
now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
print(f"[{now}] Start ETL mode={args.mode}")
if args.mode == "busy":
etl_busy.run()
else:
etl_idle.run()
print(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] ETL finished.")
if __name__ == "__main__":
main()

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
requests
psycopg2-binary