Custom Application Sources
- class datarobot.CustomApplicationSource
A DataRobot custom application source that serves as a template for creating custom applications.
Custom application sources define the code, configuration, and resource requirements used when creating custom applications. They can have resource configurations that determine the default resource allocation for applications created from this source.
- Variables:
id (
str
) – The ID of the custom application source.name (
str
) – The name of the custom application source.latest_version (
CustomApplicationSourceVersion
) – Information about the latest version of this source.user_id (
str
) – The ID of the user who created the source.org_id (
str
) – The organization ID.permissions (
List[str]
) – List of permissions for the current user.created_at (
str
) – Timestamp when the source was created.updated_at (
str
) – Timestamp when the source was last updated.created_by (
str
) – Email of the user who created the source.creator_first_name (
str
) – First name of the creator.creator_last_name (
str
) – Last name of the creator.creator_userhash (
str
) – Userhash of the creator.
Notes
Resource configuration is stored in the latest_version field and can be accessed via the get_resources() method.
- classmethod list(offset=None, limit=None)
Retrieve a list of custom application sources.
- Parameters:
offset (
Optional[int]
) – Optional. Retrieve sources in a list after this number.limit (
Optional[int]
) – Optional. Retrieve only this number of sources.
- Returns:
sources – The requested list of custom application sources.
- Return type:
List[CustomApplicationSource]
- classmethod get(source_id)
Retrieve a single custom application source with full details.
- Parameters:
source_id (
str
) – The ID of the custom application source to retrieve.- Returns:
source – The requested custom application source.
- Return type:
- classmethod create(name)
Create a new custom application source.
- Parameters:
name (
str
) – The name for the new custom application source.- Returns:
source – The newly created custom application source.
- Return type:
- update(name=None)
Update this custom application source.
- Parameters:
name (
Optional[str]
) – New name for the source. If None, name will not be changed.- Returns:
source – The updated custom application source.
- Return type:
- delete(hard_delete=False)
Delete this custom application source.
- Parameters:
hard_delete (
bool
, optional) – If True, permanently delete the source and all its data. If False (default), soft delete the source (can be recovered).- Return type:
None
Note
Deleting a source will affect all its versions. Applications created from this source will continue to run but cannot be recreated from the source.
Examples
from datarobot import CustomApplicationSource source = CustomApplicationSource.get("source_id") source.delete() # Soft delete source.delete(hard_delete=True) # Permanent delete
- get_resources()
Get resource configuration for applications created from this source.
- Returns:
resources – Resource configuration including replicas, resource bundle, and other settings. Returns None if no resources are configured.
- Return type:
Optional[Dict[str
,Any]]
- get_resource_summary()
Get a human-readable summary of resource configuration.
- Returns:
summary – A summary of resource configuration with readable descriptions. Returns None if no resources are configured.
- Return type:
Optional[Dict[str
,Any]]
- property has_resources_configured: bool
Check if this source has resource configuration.
- Returns:
True if resources are configured, False otherwise.
- Return type:
bool
- get_details()
Get comprehensive details about this custom application source.
- Returns:
details – Comprehensive source details including metadata, version info, and resources.
- Return type:
Dict[str
,Any]
- classmethod get_by_name(name)
Find a custom application source by name.
- Parameters:
name (
str
) – The name of the custom application source to find.- Returns:
source – The custom application source if found, None otherwise.
- Return type:
Optional[CustomApplicationSource]
- create_application(name, resources=None, environment_id=None)
Create a Custom Application from this source.
- Parameters:
name (
str
) – Name for the new application.resources (
Optional[Dict[str
,Any]]
) – Resource configuration for the application. If None, uses source defaults.environment_id (
Optional[str]
) – The ID of the execution environment to use. If None, uses source default.external_access_enabled (
bool
) – Whether to enable external access. Default is False.external_access_recipients (
Optional[List[str]]
) – List of email addresses for external access recipients.
- Returns:
application – The newly created Custom Application.
- Return type:
Examples
from datarobot import CustomApplicationSource source = CustomApplicationSource.get("source_id") # Create with default settings app1 = source.create_application("My App") # Create with custom resources and environment app2 = source.create_application( "My App", resources={"replicas": 2, "resourceLabel": "cpu.large"}, environment_id="env_id_123" )
- get_versions()
Get all versions of this custom application source.
- Returns:
versions – List of version information for this source.
- Return type:
List[Dict[str
,Any]]
- get_version(version_id)
Get details of a specific version of this source.
- Parameters:
version_id (
str
) – The ID of the version to retrieve.- Returns:
version – Version details including files, environment, and configuration.
- Return type:
Dict[str
,Any]
- update_resources(resource_label=None, replicas=None, session_affinity=None, service_web_requests_on_root_path=None)
Update resource configuration for this source.
- Parameters:
resource_label (
Optional[str]
) – Resource bundle ID (e.g., ‘cpu.small’, ‘cpu.large’).replicas (
Optional[int]
) – Number of replicas (1-4).session_affinity (
Optional[bool]
) – Whether to enable session affinity.service_web_requests_on_root_path (
Optional[bool]
) – Whether to serve requests on root path.
- Returns:
source – The updated custom application source.
- Return type:
- get_file(version_id, item_id)
Retrieve a specific file from a version of this custom application source.
- Parameters:
version_id (
str
) – The ID of the source version containing the file.item_id (
str
) – The ID of the file to download.
- Returns:
file_data – The file information and content as a JSON object.
- Return type:
Dict[str
,Any]
Examples
from datarobot import CustomApplicationSource source = CustomApplicationSource.get("source_id") # Get the latest version versions = source.get_versions() version_id = versions[0]["id"] # Get a file from that version version_info = source.get_version(version_id) item_id = version_info["items"][0]["id"] file_data = source.get_file(version_id, item_id) print(f"File name: {file_data.get('fileName', 'Unknown')}") if 'content' in file_data: print(f"Content: {file_data['content']}")