1.0.0 : Web Implemented.

This commit is contained in:
2026-01-26 02:13:06 +08:00
parent 026a8fe65d
commit 8dabf0b097
55 changed files with 4545 additions and 3 deletions

View File

@@ -0,0 +1,40 @@
import subprocess
import os
import sys
from web.config import Config
class EtlService:
@staticmethod
def run_script(script_name, args=None):
"""
Executes an ETL script located in the ETL directory.
Returns (success, message)
"""
script_path = os.path.join(Config.BASE_DIR, 'ETL', script_name)
if not os.path.exists(script_path):
return False, f"Script not found: {script_path}"
try:
# Use the same python interpreter
python_exe = sys.executable
cmd = [python_exe, script_path]
if args:
cmd.extend(args)
result = subprocess.run(
cmd,
cwd=Config.BASE_DIR,
capture_output=True,
text=True,
timeout=300 # 5 min timeout
)
if result.returncode == 0:
return True, f"Success:\n{result.stdout}"
else:
return False, f"Failed (Code {result.returncode}):\n{result.stderr}\n{result.stdout}"
except Exception as e:
return False, str(e)