Skip to content

promote-model

Promotes a challenger model version to Production stage in MLflow, archiving the previous champion.

Overview

Property Value
Trigger Step Functions / Direct
Runtime Python 3.11
Timeout 120 seconds
Memory 256 MB

Input Schema

{
    "model_name": "PascalStrategy",     # Required
    "new_version": "3",                 # Optional, uses latest Staging if not specified
    "confidence": 0.85                  # Comparison confidence score (0.0-1.0)
}

Output Schema

{
    "promoted": true,
    "new_version": "3",
    "new_stage": "Production",
    "archived_version": "2"             # Previous Production version
}

Failure Response:

{
    "promoted": false,
    "reason": "No Staging version found"
}

Environment Variables

Variable Required Default Description
MLFLOW_TRACKING_URI Yes - MLflow server URL
MLFLOW_TRACKING_USERNAME No - MLflow username
MLFLOW_TRACKING_PASSWORD No - MLflow password
ALERT_SNS_TOPIC_ARN Yes - SNS topic for notifications
ENVIRONMENT No "dev" Environment name

Promotion Process

flowchart TD
    A[Promotion Request] --> B{Version specified?}
    B -->|Yes| C[Use specified version]
    B -->|No| D[Find latest Staging]
    D -->|Found| C
    D -->|Not found| E[Return error]
    C --> F{Current Production exists?}
    F -->|Yes| G[Archive current Production]
    F -->|No| H[Skip archive]
    G --> H
    H --> I[Transition to Production]
    I --> J[Send SNS notification]
    J --> K[Return success]

Key Features

  • Archives old Production version FIRST to avoid race conditions
  • Falls back to latest Staging version if not specified
  • Includes confidence score from model comparison in notifications
  • Uses MLflowAdapter for atomic stage transitions

Step Functions Integration

{
  "PromoteModel": {
    "Type": "Task",
    "Resource": "arn:aws:lambda:...:promote-model",
    "Parameters": {
      "model_name.$": "$.model_name",
      "new_version.$": "$.challenger_version",
      "confidence.$": "$.comparison.confidence"
    },
    "Next": "NotifySuccess"
  }
}

SNS Notification Format

Model Promotion Completed

Model: PascalStrategy
New Production Version: 3
Previous Version: 2
Comparison Confidence: 85.0%
Environment: prod