Skip to content

Custom Application Sources

CustomApplicationSource

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

Attribute Type Description
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 Optional[str] First name of the creator.
creator_last_name Optional[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.

list()

classmethod list()

Retrieve a list of custom application sources.

Parameters

Parameter Type Description
offset Optional[int] Optional. Retrieve sources in a list after this number.
limit Optional[int] Optional. Retrieve only this number of sources.

Returns

Returns Description
sources The requested list of custom application sources.

Return type: List[CustomApplicationSource]

get()

classmethod get()

Retrieve a single custom application source with full details.

Parameters

Parameter Type Description
source_id str The ID of the custom application source to retrieve.

Returns

Returns Description
source The requested custom application source.

Return type: CustomApplicationSource

create()

classmethod create()

Create a new custom application source.

Parameters

Parameter Type Description
name str The name for the new custom application source.

Returns

Returns Description
source The newly created custom application source.

Return type: CustomApplicationSource

update()

method update()

Update this custom application source.

Parameters

Parameter Type Description
name Optional[str] New name for the source. If None, name will not be changed.

Returns

Returns Description
source The updated custom application source.

Return type: CustomApplicationSource

delete()

method delete()

Delete this custom application source.

Parameters

Parameter Type Description
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()

method get_resources()

Get resource configuration for applications created from this source.

Returns

Returns Description
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()

method get_resource_summary()

Get a human-readable summary of resource configuration.

Returns

Returns Description
summary A summary of resource configuration with readable descriptions. Returns None if no resources are configured.

Return type: Optional[Dict[str, Any]]

has_resources_configured

property has_resources_configured

Check if this source has resource configuration.

Returns

Returns Description
True if resources are configured, False otherwise.

Return type: bool

get_details()

method get_details()

Get comprehensive details about this custom application source.

Returns

Returns Description
details Comprehensive source details including metadata, version info, and resources.

Return type: Dict[str, Any]

get_by_name()

classmethod get_by_name()

Find a custom application source by name.

Parameters

Parameter Type Description
name str The name of the custom application source to find.

Returns

Returns Description
source The custom application source if found, None otherwise.

Return type: Optional[CustomApplicationSource]

create_application()

method create_application()

Create a Custom Application from this source.

Parameters

Parameter Type Description
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

Returns Description
application The newly created Custom Application.

Return type: CustomApplication

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()

method get_versions()

Get all versions of this custom application source.

Returns

Returns Description
versions List of version information for this source.

Return type: List[Dict[str, Any]]

get_version()

method get_version()

Get details of a specific version of this source.

Parameters

Parameter Type Description
version_id str The ID of the version to retrieve.

Returns

Returns Description
version Version details including files, environment, and configuration.

Return type: Dict[str, Any]

update_resources()

method update_resources()

Update resource configuration for this source.

Parameters

Parameter Type Description
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

Returns Description
source The updated custom application source.

Return type: CustomApplicationSource

get_file()

method get_file()

Retrieve a specific file from a version of this custom application source.

Parameters

Parameter Type Description
version_id str The ID of the source version containing the file.
item_id str The ID of the file to download.

Returns

Returns Description
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']}")