Files
geointel/scripts/cleanup_demo_artifacts.py
T
Codex 6bf0610147
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled
Make demo cleanup runnable in backend container
2026-06-17 01:48:08 +02:00

33 lines
1.0 KiB
Python

from __future__ import annotations
import importlib.util
from pathlib import Path
from types import ModuleType
def load_backend_script() -> ModuleType:
script = Path(__file__).resolve().parents[1] / "backend" / "scripts" / "cleanup_demo_artifacts.py"
spec = importlib.util.spec_from_file_location("backend_cleanup_demo_artifacts", script)
if spec is None or spec.loader is None:
raise RuntimeError(f"Could not load cleanup implementation from {script}")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
_impl = load_backend_script()
DEMO_PROJECT_NAME = _impl.DEMO_PROJECT_NAME
is_within_storage_root = _impl.is_within_storage_root
export_created_at = _impl.export_created_at
select_cleanup_candidates = _impl.select_cleanup_candidates
export_path = _impl.export_path
prune_empty_parents = _impl.prune_empty_parents
cleanup_demo_exports = _impl.cleanup_demo_exports
build_parser = _impl.build_parser
main = _impl.main
if __name__ == "__main__":
raise SystemExit(main())