Custom templates
- class datarobot.models.custom_templates.CustomTemplate
Template for custom activity (e.g. custom-metrics, applications).
- classmethod create(name, description, template_type, template_sub_type, template_metadata, default_environment, file, default_resource_bundle_id=None, enabled=None, is_hidden=None)
Create the custom template.
Added in version v3.9.
- Parameters:
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:
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', )
- classmethod list(search=None, order_by=None, tag=None, template_type=None, template_sub_type=None, publisher=None, category=None, show_hidden=None, offset=None, limit=None)
List all custom templates.
Added in version v3.7.
- Parameters:
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:
templates
- Return type:
List[CustomTemplate]
- classmethod get(template_id)
Get a custom template by ID.
Added in version v3.7.
- Parameters:
template_id (
str
) – ID of the template.- Returns:
template
- Return type:
- update(name=None, description=None, default_resource_bundle_id=None, template_type=None, template_sub_type=None, template_metadata=None, default_environment=None, file=None, enabled=None, is_hidden=None)
Update the custom template.
Added in version v3.7.
- Parameters:
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()
Delete this custom template.
Added in version v3.7.
- Return type:
None
- download_content(index=None, filename=None)
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:
filename (
Optional[str]
) – The file name to retrieve.index (
Optional[int]
) – Index of the item to retrieve.
- Return type:
Bytes content
ofthe file.
- class datarobot.models.custom_templates.DefaultEnvironment
Default execution environment.
- class datarobot.models.custom_templates.CustomMetricMetadata
Metadata for custom metrics.
- class datarobot.models.custom_templates.TemplateMetadata
Metadata for the custom templates.