Skip to main content
Operations
What this does: Coordinates the entire ML workflow with automated scheduling — from data ingestion to model deployment — ensuring every step runs reliably and on time without manual oversight.
The system relies on Apache Airflow 2.10 to orchestrate the end-to-end machine learning workflow.

Production Pipeline DAG

The active pipeline (airflow_dag_enhanced.py) integrates robust tracking and persistence mechanisms.

Advanced Capabilities

DAG Configuration


Kedro Pipelines

While Airflow manages the schedule, Kedro defines the logic. The system is composed of three modular pipelines that transform raw data into production-ready models.

Data Processing

  • Goal: Sanitize raw inputs and validate schema.
  • Key Node: preprocess_data cleans nulls and standardizes the timestamp format.
  • Validation: profile_dataset_gx automatically generates a Great Expectations report to catch data quality issues early.

Feature Engineering

  • Goal: Create predictive signals for the model.
  • Key Node: create_derived_features extracts critical signals like hour_of_day, is_weekend, and temperature lags that drive forecast accuracy.

Demand Modeling

  • Goal: Train, tune, and select the best model.
  • Strategy: Challenger/Champion.
    • Challenger: A baseline Random Forest (train_single_model).
    • Champion: A CatBoost Regressor (train_catboost_model) optimized via Optuna.
  • Selection: The compare_models node evaluates MAE/RMSE and promotes the winner to the MLflow Registry.

Dataset Monitoring

Runs independently (@hourly) to ensure data freshness and quality.
1

Check Freshness

Scans S3 prefixes to verify data arrival within SLAs (e.g., Raw Data < 24h old).
2

Calculate Drift

Computes the against the reference dataset to detect silent model degradation.
3

Alerting Logic

  • Critical Alerts: Immediate email if critical datasets (Raw Data, Trained Model) are stale.
  • Daily Report: Sent at 08:00 UTC summarizing global system health.
4

Metric Export

Health metrics are appended to dataset_events.csv for long-term trend analysis.

Production Hardening

The pipeline is engineered for resilience, not just functionality.

Service Level Objectives

Key performance targets hardcoded into the pipeline validation logic:

Failure Handling

  • Automatic Retries: Tasks retry once (retries=1) after a 1-minute backoff to handle transient network blips.
  • Optuna Persistence: If the optimization worker crashes, the PostgreSQL backend preserves the study state, allowing the next run to resume without losing progress.
  • Graceful Degradation: If MLflow or Optuna DB is unreachable, the pipeline logs a warning but proceeds with local execution to ensure business continuity.

Pipeline Configuration

Infrastructure endpoints managed via Airflow Variables and Environment Variables.