Model Stages
Model stages allow you to organize and manage different versions of your models for different environments. Any version of a Chariot model (e.g., v1.0.0
) can be set as the active staging
or production
model stage.
Stage Management
When a model version is in one of the active stages:
- The model version is protected and cannot be deleted. Any model version that has ever been in the
production
stage is consideredarchived
and can never be deleted even if a different model version is moved toproduction
. staging
andproduction
each have a single model version. This can be the same version for staging and production or different versions for each. For example,v1.0.0
could be the activestaging
model andv1.0.1
could be the activeproduction
model, orv1.0.1
could be bothstaging
andproduction
.- An active model can be replaced by another model version.
Stage Protection Matrix
Not Active | Staging | Production | |
---|---|---|---|
Delete protection when active | X | X | |
Delete protection when archived | X |
Setting Model Stages
- UI
- SDK
- Navigate to your model.
- Click the more button (...) in the model actions area.
- Choose either Promote to Staging or Promote to Production from the drop-down menu.
- Confirm the action, and the model will be immediately promoted to the selected stage.
You can view the current model stage near the title of the model and in the model history tab.
The SDK can be used to set the stage of model, get the model version for the various stages, and view the stage history.
from chariot.client import connect
from chariot.models import Model, Stage, set_stage, get_active_stages, get_stage_history
connect()
# Select the model version (e.g., v1.0.0).
model = Model(project_id="<project_id>", id="<model_id_v1.0.0>")
# Set the desired model to staging.
set_stage(model, Stage.STAGING)
# Set the desired model to production.
set_stage(model, Stage.PRODUCTION)
# View the currently active model versions.
active_stages = get_active_stages(model)
# {'archived': [],
# 'production': {'model_id': '<model_id_v1.0.0>'},
# 'staging': {'model_id': '<model_id_v1.0.0>'}
# Select a different model version (e.g., v1.0.1) and replace v1.0.0 as active production.
a_different_model = Model(project_id="<project_id>", id="<model_id_v1.0.1>")
set_stage(a_different_model, Stage.PRODUCTION)
# v1.0.0 is active in staging, v1.0.1 is active in production, and v1.0.0 is in the archived list since v1.0.1 replaced it as the active production.
active_stages = get_active_stages(model)
# {'archived': ['<model_id_v1.0.0>'],
# 'production': {'<model_id>': '<model_id_v1.0.1>'},
# 'staging': {'<model_id>': '<model_id_v1.0.0>'}
# View the history of model stage changes.
history = get_stage_history(model)
# [{'created_at': 1686587177,
# 'model_id': '<model_id_v1.0.1>',
# 'stage': 'production',
# 'version': '1.0.1'},
# {'created_at': 1686164156,
# 'model_id': '<model_id_v1.0.0>',
# 'stage': 'production',
# 'version': '1.0.0'},
# {'created_at': 1686164087,
# 'model_id': '<model_id_v1.0.0>',
# 'stage': 'staging',
# 'version': '1.0.0'}]