How googlecloudplatform/ml-auto-solutions works
Project Type and Purpose
• MAS is a full-stack orchestration system for end-to-end ML tests and benchmarks, built on Google Cloud.
• It uses Terraform for infra provisioning (Cloud Composer), Airflow DAGs for orchestration, Compute/GKE/TPU resources for workloads, BigQuery for metrics, and optional dashboards via Looker Studio.
Main Components and How to Represent Them
a. Source & CI/CD
• GitHub repo (with .github/workflows, pipeline/auto-push.cloudbuild.yml)
• Cloud Build / GitHub Actions pipelines
b. Infrastructure Provisioning
• Terraform modules under deployment/…
• Resources: Cloud Composer environment, Artifact Registry, BigQuery datasets, GCS buckets
c. Orchestration Layer
• Cloud Composer (Airflow)
• GCS “dags” bucket storing all DAG definitions (the “dags” directory in the repo)
d. DAG Definitions & Python Library
• dags/… Python packages: dag definitions, configs, utils
• xlml/… client‐library for GCP APIs (GCS, Composer, GKE, BigQuery, TPU, etc.)
e. Compute Workloads
• Tasks launch VMs/containers on GCE, GKE, TPU, GPU (via xlml/utils and dag-specific scripts)
• Example workloads: model training, inference, profiling, microbenchmarks
f. Data & Metrics
• BigQuery tables for job_history, metric_history, metadata_history (deployment/schema)
• Downstream consumption by Looker Studio or other BI tools
Relationships & Data Flows
• Developers push code → CI/CD pipelines run lint/tests → upon merge, Cloud Build uploads new DAG code to GCS bucket.
• Terraform applies provisioning → spins up Composer environment, BigQuery datasets, GCS buckets.
• Composer polls GCS bucket → Airflow Scheduler loads DAG definitions.
• Each DAG (e.g., in dags/inference, dags/multipod…) orchestrates tasks:
· Uses xlml library to provision compute resources
· Runs ML benchmarks/training/inference on VMs/TPUs
· Collects logs and metrics → writes to BigQuery
• Dashboards query BigQuery for monitoring.
Architectural Patterns & Design Principles
• Infrastructure-as-Code (Terraform) for reproducible provisioning
• Modular Airflow architecture: separate DAGs per use-case, shared utils/config packages
• Client‐library abstraction (xlml) to encapsulate GCP API calls
• Clear separation between orchestration (Airflow) and compute (GCE/GKE/TPU)
• Centralized metrics store (BigQuery) decoupled from compute
Essential Elements
• Clear labels for each service (e.g., “Cloud Composer (Airflow)”) and code module (e.g., “dags/inference”).
· Blue for control-plane services (Terraform, Cloud Build)
· Green for orchestration (Composer, Airflow)
· Orange for compute (GCE, GKE, TPU)
· Yellow for data stores (GCS, BigQuery)