# master1039/mlops-v2-ado-demo architecture

> Architecture diagram of the GitHub repository master1039/mlops-v2-ado-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/master1039/mlops-v2-ado-demo
- Repository: https://github.com/master1039/mlops-v2-ado-demo

## Overview

##### Project type and purpose
- This is an end-to-end MLOps project orchestrating Azure infrastructure provisioning, data science experimentation, model training, registration, and deployment using Azure Machine Learning SDK and Azure DevOps pipelines.
- Key indicators: multiple YAML files for infra (infra/, aml-cli-v2/), DevOps pipelines (mlops/devops-pipelines/), data-science code (data-science/src/), and Azure ML deployment artifacts (mlops/azureml/).

##### File structure
- Top-level directories:
- aml-cli-v2: reusable Azure CLI playbooks for workspace setup, compute, endpoints, etc.
- infra: ARM/Terraform-style YAML templates for resource group, registry, workspace.
- data-science: Conda environment, notebooks and Python modules for prep, train, evaluate, register, plus unit tests.
- mlops: Azure ML pipeline definitions (train, deploy), Azure DevOps pipeline definitions (CI/CD for infra, unit tests, training pipeline, deployment).
- Configuration & manifest files: environment.yml, requirements.txt, .pre-commit-config.yaml.
- Patterns: pipeline-as-code, infrastructure-as-code, modular CLI playbooks.

##### README for additional insights
- Describes prerequisites (Azure subscription/DevOps project).
- Walks through service principal creation, service connection in Azure DevOps, repository import, pipeline permissions.
- Mentions stages: “Deploying infrastructure via Azure DevOps,” “Training and Deployment Scenario,” “Deploying model training pipeline,” “Deploying the Trained model.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Layer
    subgraph "Developer Environment"
        Dev["Developer Machine"]:::dev
        Git["Git Repo (monorepo)"]:::dev
    end
    Dev -->|push code| Git

    %% Azure DevOps Layer
    subgraph "Azure DevOps (Repos & Pipelines)"
        CI["CI Pipeline\n(cli-ado-unittest-pipeline.yml)"]:::ado
        InfraPipe["Infra Provisioning Pipeline\n(cli-ado-deploy-infra.yml)"]:::ado
        TrainPipe["Training Pipeline Deployment\n(deploy-model-training-pipeline.yml)"]:::ado
        DeployPipe["Online Endpoint Deployment Pipeline\n(deploy-online-endpoint-pipeline.yml)"]:::ado
    end
    Git --> CI
    CI -->|trigger| InfraPipe
    CI -->|run unit tests| UnitTests["Unit Tests\n(aml-cli-v2/tests/unit-tests.yml)"]:::ado

    %% Infrastructure Code
    subgraph "Infrastructure-as-Code Templates"
        RGCode["create-resource-group.yml"]:::code
        WSCode["create-workspace.yml"]:::code
        ACRCode["create-registry.yml"]:::code
        RegCode["registry.yml"]:::code
        ConnectWSCode["connect-to-workspace.yml"]:::code
    end
    InfraPipe -->|deploy RG| RGCode
    InfraPipe -->|deploy Workspace| WSCode
    InfraPipe -->|deploy ACR| ACRCode
    InfraPipe -->|configure Workspace| ConnectWSCode

    %% Azure Resources
    subgraph "Azure Resources" 
        RG["Resource Group"]:::azure
        WS["Azure ML Workspace"]:::azure
        ACR["Azure Container Registry"]:::azure
        Storage["Data Storage (Blob/Data Lake)"]:::azure
        Compute["Compute\n(Instances/Clusters)"]:::azure
        ModelReg["Model Registry"]:::azure
        EPOnline["Online Endpoint"]:::endpoint
        EPBatch["Batch Endpoint"]:::endpoint
    end
    RGCode --> RG
    WSCode --> WS
    ACRCode --> ACR
    ConnectWSCode --> WS

    %% AML CLI v2 Playbooks
    subgraph "AML CLI v2 Playbooks" 
        InstallAz["install-az-cli.yml"]:::cli
        InstallAML["install-aml-cli.yml"]:::cli
        ConnectCLI["connect-to-workspace.yml"]:::cli
        CreateCompute["create-compute.yml"]:::cli
        RegisterEnv["register-environment.yml"]:::cli
        RegisterData["register-data.yml"]:::cli
        RunPL["run-pipeline.yml"]:::cli
        CreateEP["create-endpoint.yml"]:::cli
        CreateDep["create-deployment.yml"]:::cli
        AllocTraffic["allocate-traffic.yml"]:::cli
        TestDep["test-deployment.yml"]:::cli
    end
    InfraPipe --> InstallAz
    InfraPipe --> InstallAML
    InfraPipe --> ConnectCLI
    TrainPipe --> RunPL
    DeployPipe --> CreateEP
    DeployPipe --> CreateDep
    DeployPipe --> AllocTraffic
    DeployPipe --> TestDep

    %% Data Science Code
    subgraph "Data-Science Modules & Tests"
        Prep["prep.py"]:::ds
        TestPrep["test_prep.py"]:::ds
        TrainCode["train.py"]:::ds
        TestTrain["test_train.py"]:::ds
        EvalCode["evaluate.py"]:::ds
        TestEval["test_evaluate.py"]:::ds
        RegisterCode["register.py"]:::ds
    end
    CI -->|lint & tests| TestPrep
    CI --> TestTrain
    CI --> TestEval
    TrainPipe --> Prep
    TrainPipe --> TrainCode
    TrainPipe --> EvalCode
    TrainPipe --> RegisterCode

    %% Training Pipeline
    subgraph "Azure ML Training Pipeline"
        TrainPL["pipeline.yml"]:::azureml
        DataYML["data.yml"]:::azureml
        EnvYML["train-env.yml"]:::azureml
    end
    RunPL --> DataYML
    RunPL --> EnvYML
    RunPL --> TrainPL
    TrainPL --> Prep
    TrainPL --> TrainCode
    TrainPL --> EvalCode
    TrainPL --> RegisterCode
    TrainCode -->|register model| ModelReg

    %% Deployment Artifacts
    subgraph "Azure ML Deployment Artifacts"
        subgraph "Online Deployment"
            OnlineEPYML["online-endpoint.yml"]:::azureml
            OnlineDepYML["online-deployment.yml"]:::azureml
            ScoreScript["score.py"]:::azureml
        end
        subgraph "Batch Deployment"
            BatchEPYML["batch-endpoint.yml"]:::azureml
            BatchDepYML["batch-deployment.yml"]:::azureml
        end
    end
    CreateEP --> OnlineEPYML
    CreateDep --> OnlineDepYML
    CreateDep --> ScoreScript
    CreateEP --> BatchEPYML
    CreateDep --> BatchDepYML
    OnlineDepYML --> EPOnline
    BatchDepYML --> EPBatch

    %% Data Storage Samples
    subgraph "Sample Data"
        TaxiCSV["taxi-data.csv"]:::data
        BatchCSV["taxi-batch.csv"]:::data
        RequestJSON["taxi-request.json"]:::data
    end
    Storage --> TaxiCSV
    Storage --> BatchCSV
    Storage --> RequestJSON
    Prep --> Storage

    %% Consumers
    Consumers["REST Clients\n(Online & Batch)"]:::endpoint
    EPOnline --> Consumers
    EPBatch --> Consumers

    %% Click events
    click RGCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/infra/create-resource-group.yml"
    click WSCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/infra/create-workspace.yml"
    click ACRCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/infra/create-registry.yml"
    click RegCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/infra/registry.yml"
    click ConnectWSCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/infra/connect-to-workspace.yml"
    click InstallAz "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/install-az-cli.yml"
    click InstallAML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/install-aml-cli.yml"
    click ConnectCLI "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/connect-to-workspace.yml"
    click CreateCompute "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/create-compute.yml"
    click RegisterEnv "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/register-environment.yml"
    click RegisterData "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/register-data.yml"
    click RunPL "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/run-pipeline.yml"
    click CreateEP "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/create-endpoint.yml"
    click CreateDep "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/create-deployment.yml"
    click AllocTraffic "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/allocate-traffic.yml"
    click TestDep "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/test-deployment.yml"
    click UnitTests "https://github.com/master1039/mlops-v2-ado-demo/blob/main/aml-cli-v2/tests/unit-tests.yml"
    click Prep "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/prep/prep.py"
    click TestPrep "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/prep/test_prep.py"
    click TrainCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/train/train.py"
    click TestTrain "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/train/test_train.py"
    click EvalCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/evaluate/evaluate.py"
    click TestEval "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/evaluate/test_evaluate.py"
    click RegisterCode "https://github.com/master1039/mlops-v2-ado-demo/blob/main/data-science/src/register/register.py"
    click DataYML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/train/data.yml"
    click EnvYML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/train/train-env.yml"
    click TrainPL "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/train/pipeline.yml"
    click OnlineEPYML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/deploy/online/online-endpoint.yml"
    click OnlineDepYML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/deploy/online/online-deployment.yml"
    click ScoreScript "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/deploy/online/score.py"
    click BatchEPYML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/deploy/batch/batch-endpoint.yml"
    click BatchDepYML "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/azureml/deploy/batch/batch-deployment.yml"
    click CI "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/devops-pipelines/cli-ado-unittest-pipeline.yml"
    click InfraPipe "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/devops-pipelines/cli-ado-deploy-infra.yml"
    click TrainPipe "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/devops-pipelines/deploy-model-training-pipeline.yml"
    click DeployPipe "https://github.com/master1039/mlops-v2-ado-demo/blob/main/mlops/devops-pipelines/deploy-online-endpoint-pipeline.yml"

    %% Styles
    classDef dev fill:#d0e0ff,stroke:#036,stroke-width:1px
    classDef ado fill:#cfe7ff,stroke:#036,stroke-width:1px
    classDef code fill:#e8f1f9,stroke:#228,stroke-width:1px
    classDef azure fill:#e0ffe0,stroke:#070,stroke-width:1px
    classDef cli fill:#f0f0f0,stroke:#888,stroke-width:1px
    classDef ds fill:#fff8c6,stroke:#aa0,stroke-width:1px
    classDef azureml fill:#ddffdd,stroke:#070,stroke-width:1px
    classDef endpoint fill:#ffe0b2,stroke:#a50,stroke-width:1px
    classDef data fill:#f5f5dc,stroke:#a66,stroke-width:1px
```
