40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Lance l'ensemble du pipeline de préparation des données brutes en une commande."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
COMMANDS = [
|
|
[sys.executable, "-m", "scripts.clean_csv_exports"],
|
|
[sys.executable, "docs/02 - Préparation des données/scripts/export_station_data_full.py"],
|
|
[sys.executable, "docs/02 - Préparation des données/scripts/format_raw_csv.py"],
|
|
[sys.executable, "docs/02 - Préparation des données/scripts/fill_formatted_1s.py"],
|
|
[sys.executable, "docs/02 - Préparation des données/scripts/make_minutely_dataset.py"],
|
|
]
|
|
|
|
|
|
def run_commands() -> int:
|
|
for cmd in COMMANDS:
|
|
print(f"\n=== Exécution : {' '.join(cmd)} ===")
|
|
result = subprocess.run(cmd, cwd=ROOT, check=False)
|
|
if result.returncode != 0:
|
|
print(f"✘ Commande échouée ({result.returncode}) : {' '.join(cmd)}")
|
|
return result.returncode
|
|
print("✔ OK")
|
|
return 0
|
|
|
|
|
|
def main() -> None:
|
|
code = run_commands()
|
|
if code == 0:
|
|
print("\n✔ Pipeline de préparation exécuté sans erreur.")
|
|
sys.exit(code)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|