Prediction environment

class datarobot.models.PredictionEnvironment

Bases: APIObject

A prediction environment entity.

Added in version v3.3.0.

Variables:
  • id (str) – The ID of the prediction environment.

  • name (str) – The name of the prediction environment.

  • description (Optional[str]) – The description of the prediction environment.

  • platform (Optional[str]) – Indicates which platform is in use (AWS, GCP, DataRobot, etc.).

  • permissions (Optional[List]) – A set of permissions for the prediction environment.

  • is_deleted (boolean, optional) – The flag that shows if this prediction environment deleted.

  • supported_model_formats (list[PredictionEnvironmentModelFormats], optional) – The list of supported model formats.

  • is_managed_by_management_agent (boolean, optional) – Determines if the prediction environment should be managed by the management agent. False by default.

  • datastore_id (Optional[str]) – The ID of the data store connection configuration. Only applicable for external prediction environments managed by DataRobot.

  • credential_id (Optional[str]) – The ID of the credential associated with the data connection. Only applicable for external prediction environments managed by DataRobot.

classmethod list()

Returns list of available external prediction environments.

Returns:

prediction_environments – contains a list of available prediction environments.

Return type:

list of PredictionEnvironment instances

Examples

>>> import datarobot as dr
>>> prediction_environments = dr.PredictionEnvironment.list()
>>> prediction_environments
[
    PredictionEnvironment('5e429d6ecf8a5f36c5693e03', 'demo_pe', 'aws', 'env for demo testing'),
    PredictionEnvironment('5e42cc4dcf8a5f3256865840', 'azure_pe', 'azure', 'env for azure demo testing'),
]
classmethod get(pe_id)

Gets the PredictionEnvironment by id.

Parameters:

pe_id (str) – the identifier of the PredictionEnvironment.

Returns:

prediction_environment – the requested prediction environment object.

Return type:

PredictionEnvironment

Examples

>>> import datarobot as dr
>>> pe = dr.PredictionEnvironment.get('5a8ac9ab07a57a1231be501f')
>>> pe
PredictionEnvironment('5a8ac9ab07a57a1231be501f', 'my_predict_env', 'aws', 'demo env'),
delete()

Deletes the prediction environment. :rtype: None

Examples

>>> import datarobot as dr
>>> pe = dr.PredictionEnvironment.get('5a8ac9ab07a57a1231be501f')
>>> pe.delete()
classmethod create(name, platform, description=None, plugin=None, supported_model_formats=None, is_managed_by_management_agent=False, datastore=None, credential=None)

Create a prediction environment.

Parameters:
  • name (str) – The name of the prediction environment.

  • description (Optional[str]) – The description of the prediction environment.

  • platform (str) – Indicates which platform is in use (AWS, GCP, DataRobot, etc.).

  • plugin (str) – Optional. The plugin name to use.

  • supported_model_formats (list[PredictionEnvironmentModelFormats], optional) – The list of supported model formats. When not provided, the default value is inferred based on platform, (DataRobot platform: DataRobot, Custom Models; All other platforms: DataRobot, Custom Models, External Models).

  • is_managed_by_management_agent (boolean, optional) – Determines if this prediction environment should be managed by the management agent. default: False

  • datastore (DataStore|Optional[str]]) – The datastore object or ID of the data store connection configuration. Only applicable for external Prediction Environments managed by DataRobot.

  • credential (Credential|Optional[str]]) – The credential object or ID of the credential associated with the data connection. Only applicable for external Prediction Environments managed by DataRobot.

Returns:

prediction_environment – the prediction environment was created

Return type:

PredictionEnvironment

Raises:

Examples

>>> import datarobot as dr
>>> pe = dr.PredictionEnvironment.create(
...     name='my_predict_env',
...     platform=PredictionEnvironmentPlatform.AWS,
...     description='demo prediction env',
... )
>>> pe
PredictionEnvironment('5e429d6ecf8a5f36c5693e99', 'my_predict_env', 'aws', 'demo prediction env'),