Skip to main content

get_deployment_info

Retrieves the branch, name, and version of the currently executing deployment. Only works inside deployments.

Returns

A dictionary with the branch, name, and version of the deployment:

{
"branch": str,
"name": str,
"version": str
}

Examples

Getting deployment info

Call get_deployment_info to get information on the current execution context:

mb.get_deployment_info()

Returns

{
"branch": "main",
"name": "my_deployment",
"version": "9"
}

Returning deployment info with inference

Include additional information in the response of deployments to aid in later analysis or debugging:

def predict():
return {
"prediction": 7,
"context": mb.get_deployment_info()
}

mb.deploy(predict)

See also