File size: 1,041 Bytes
6bf34b8
 
 
 
f2d1de7
 
 
6bf34b8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import subprocess
import sys

# 프로젝트 루트 디렉토리를 Python 경로에 추가하여 ModuleNotFoundError 방지
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))


def run_command(cmd):
    print("\n========================================")
    print(f"Running: {cmd}")
    print("========================================\n")
    env = os.environ.copy()
    env["PYTHONUTF8"] = "1"
    result = subprocess.run(cmd, shell=True, env=env)
    if result.returncode != 0:
        print(f"Command failed with exit code {result.returncode}: {cmd}")
        sys.exit(result.returncode)


if __name__ == "__main__":
    print("Starting background rebuilding pipeline...")
    # 1. 크롤링 (finScrapping.py)
    run_command(r".\.venv\Scripts\python.exe src/graphBuilder/scrapping/finScrapping.py")
    
    # 2. 지식 그래프 빌드 (finGraph.py)
    run_command(r".\.venv\Scripts\python.exe src/graphBuilder/neo4j/finGraph.py")
    
    print("\n[OK] Background rebuilding pipeline completed successfully!")