Skip to main content

Organizing with tags

Use tags to organize your many deployments. Typical tags organize deployments by project or purpose.

Modelbit supports two kinds of tags: built-in tags and user-defined tags.

Built-in tags

Deployments are automatically tagged with their running status. The running statuses are:

  • Executing: Deployments that are currently running a request (or ran one within the last few seconds) are tagged Executing. If your deployments run with constant traffic they will generally always have the Executing tag. If a deployment stops receiving traffic this tag will change to Ready.
  • Ready: Deployments that haven't been called recently, but are still loaded onto a Modelbit server, are tagged Ready. These deployments are "ready" to wake up and begin executing shortly after the next time a request arrives. Once they start executing this tag will change to Executing.
  • Cold: Deployments that can be called but aren't currently loaded on a Modelbit server are tagged Cold. The next time a request comes in for one these deployments it'll take a little while to "cold start" as the environment, dependencies, and code are loaded.
  • Not deployed: If a deployment exists in Git but hasn't been deployed on the current branch it'll have the Not deployed tag. Click the Deploy to this branch button to deploy it for the first time.

User-defined tags

You can add tags to your deployments to keep them organized. Once your deployments have tags you can search and filter by those tags.

Managing tags in Python

Use the add_tags, delete_tags and get_tags APIs to manage tags associated with your deployments.

For example, to tag the example_deployment deployment with the tag project_zebra, call add_tags:

mb.add_tags(deployment="example_deployment", tags=["project_zebra"])

Updating the tags of your deployments with these Python APIs will not cause them to redeploy.

Managing tags in Git

Deployment tags are stored in Git within the deployment's metadata.yaml. Calling Python APIs like add_tags updates this file.

For example, to add the project_zebra tag to example_deployment, update its metadata.yaml:

deployments/example_deployment/metadata.yaml
owner: you@company.com
runtimeInfo:
pythonVersion: "3.11"
...
tags:
- project_zebra
schemaVersion: 2