Skip to content

Custom templates

CustomTemplate

class datarobot.models.custom_templates.CustomTemplate

Template for custom activity (e.g., custom-metrics, applications).

create()

classmethod create()

Create the custom template.

Added in version v3.9.

Parameters

Parameter Type Description
name str The template name.
description str A description of the template.
template_type str The template type.
template_sub_type str The template sub-type.
template_metadata TemplateMetadata\|dict[str, Any]\|str The metadata associated with the template, provided as TemplateMetadata or a JSON-encoded string.
default_environment DefaultEnvironment\|dict[str, Any]\|str The default environment associated with the template, provided as DefaultEnvironment or a JSON-encoded string.
file str The path to the template directory or file, or the contents of the template.
default_resource_bundle_id Optional[str] The default resource bundle ID.
enabled Optional[bool] Whether the template is enabled (default is true).
is_hidden Optional[bool] Whether the template is hidden (default is false).

Return type: CustomTemplate

Examples

from datarobot import CustomTemplate
from datarobot.models.custom_templates import DefaultEnvironment
def_env = DefaultEnvironment(
    environment_id='679d47c8ce1ecd17326f3fdf',
    environment_version_id='679d47c8ce1ecd17326f3fe3',
)
template = template.create(
    name="My new template",
    default_environment=def_env,
    description='Updated template with environment v17',
)

list()

classmethod list()

List all custom templates.

Added in version v3.7.

Parameters

Parameter Type Description
search Optional[str] Search string.
order_by Optional[ListCustomTemplatesSortQueryParams] Ordering field.
tag Optional[str] Tag associated with the template.
template_type Optional[str] Type of the template.
template_type Sub-type of the template.
publisher Optional[str] Only return custom templates with this publisher.
category Optional[str] Only return custom templates with this category (use case).
show_hidden Optional[bool] Whether the template is hidden (default is false).
offset Optional[int] Offset for pagination.
limit Optional[int] Limit for pagination.

Returns

Returns Description
templates

Return type: List[CustomTemplate]

get()

classmethod get()

Get a custom template by ID.

Added in version v3.7.

Parameters

Parameter Type Description
template_id str ID of the template.

Returns

Returns Description
template

Return type: CustomTemplate

update()

method update()

Update the custom template.

Added in version v3.7.

Parameters

Parameter Type Description
name Optional[str] The template name.
description Optional[str] A description of the template.
default_resource_bundle_id Optional[str] The default resource bundle ID.
template_type Optional[str] The template type.
template_sub_type Optional[str] The template sub-type.
template_metadata Optional[TemplateMetadata\|str] The metadata associated with the template, provided as TemplateMetadata or a JSON encoded string.
default_environment Optional[DefaultEnvironment\|str] The default environment associated with the template, provided as DefaultEnvironment or a JSON encoded string.
file str The path to the template directory or file, or the contents of the template.
enabled Optional[bool] Whether the template is enabled (default is true).
is_hidden Optional[bool] Whether the template is hidden (default is false).

Return type: None

Examples

from datarobot import CustomTemplate
from datarobot.models.custom_templates import DefaultEnvironment
new_env = DefaultEnvironment(
    environment_id='679d47c8ce1ecd17326f3fdf',
    environment_version_id='679d47c8ce1ecd17326f3fe3',
)
template = CustomTemplate.get(template_id='5c939e08962d741e34f609f0')
template.update(default_environment=new_env, description='Updated template with environment v17')

delete()

method delete()

Delete this custom template.

Added in version v3.7.

Return type: None

download_content()

method download_content()

Retrieve the file content for the given item.

The item can be identified by filename or index in the array of items.

Added in version v3.9.

Parameters

Parameter Type Description
filename Optional[str] The file name to retrieve.
index Optional[int] Index of the item to retrieve.

Return type: Bytes content of the file.

upload_preview()

method upload_preview()

Upload the custom template preview image file.

Added in version v3.10.

Parameters

Parameter Type Description
filename str The preview image filename.

Return type: None

DefaultEnvironment

class datarobot.models.custom_templates.DefaultEnvironment

Default execution environment.

CustomMetricMetadata

class datarobot.models.custom_templates.CustomMetricMetadata

Metadata for custom metrics.

TemplateMetadata

class datarobot.models.custom_templates.TemplateMetadata

Metadata for the custom templates.