feat: 改用Metrix API写入干扰数据
This commit is contained in:
@@ -13,7 +13,7 @@ PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
DEFAULT_IMAGE = "interference-etl-runtime:1.1"
|
||||
DEFAULT_BASE_IMAGE = "python:3.13.11-slim"
|
||||
DEFAULT_OUTPUT = PROJECT_ROOT / "dist" / "InterferenceETL-offline-1.1.zip"
|
||||
PACKAGE_FILES = ("main.py", "requirements.txt", "README.md")
|
||||
PACKAGE_FILES = ("main.py", "requirements.txt", "README.md", "runtime_config.py")
|
||||
PACKAGE_ENTRYPOINT = "from main import main\nraise SystemExit(main())\n"
|
||||
|
||||
COPY_DEPENDENCIES = r"""
|
||||
@@ -22,7 +22,7 @@ from pathlib import Path
|
||||
import shutil
|
||||
|
||||
target = Path('/package/vendor')
|
||||
for name in ('openpyxl', 'et-xmlfile', 'PyMySQL'):
|
||||
for name in ('openpyxl', 'et-xmlfile'):
|
||||
package = distribution(name)
|
||||
for item in package.files or ():
|
||||
if '__pycache__' in item.parts or item.suffix in ('.pyc', '.pyo'):
|
||||
@@ -39,6 +39,9 @@ for name in ('openpyxl', 'et-xmlfile', 'PyMySQL'):
|
||||
def build(output: Path, runtime_image: str, base_image: str) -> Path:
|
||||
output = output.resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
missing = [name for name in PACKAGE_FILES if not (PROJECT_ROOT / name).is_file()]
|
||||
if missing:
|
||||
raise FileNotFoundError(f"Missing package files: {', '.join(missing)}")
|
||||
with tempfile.TemporaryDirectory(prefix="interference-etl-package-") as temp:
|
||||
staging = Path(temp)
|
||||
subprocess.run(
|
||||
@@ -72,7 +75,7 @@ def build(output: Path, runtime_image: str, base_image: str) -> Path:
|
||||
base_image,
|
||||
"python",
|
||||
"-c",
|
||||
"import main, openpyxl, pymysql; print('offline_package_imports=ok')",
|
||||
"import main, openpyxl; print('offline_package_imports=ok')",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user