create_datalab_lifecycle_configuration¶
- DatalabsApi.create_datalab_lifecycle_configuration(role_id, datalab_lifecycle_configuration_post, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)¶
Create a datalab lifecycle configuration
Creates a lifecycle configuration whose startup script runs on the datalabs it is attached to. Notebook configurations accept an on-create and an on-start script; studio configurations require an on-start script.
- Parameters:
role_id (str) – User role id (required)
datalab_lifecycle_configuration_post (DatalabLifecycleConfigurationPost) – (required)
content_type (str) – Must be application/json.
_request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
_request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
_content_type (str, Optional) – force content-type for the request.
_headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
_host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
- Return type:
- Returns:
Returns the result object.
Request and Response Examples¶
HTTP: POST /datalabs/lifecycle-configurations
Request¶
Notebook configuration with both scripts
{
"LifecycleName": "install-team-packages",
"Description": "Installs the team's shared Python packages on startup",
"Type": "notebook",
"OnCreateScript": "IyEvYmluL2Jhc2gKcGlwIGluc3RhbGwgLXIgL2hvbWUvZWMyLXVzZXIvcmVxdWlyZW1lbnRzLnR4dAo=",
"OnStartScript": "IyEvYmluL2Jhc2gKcGlwIGluc3RhbGwgLXIgL2hvbWUvZWMyLXVzZXIvcmVxdWlyZW1lbnRzLnR4dAo=",
"Keywords": [
"ml",
"setup"
]
}
Studio configuration - on-start script is required
{
"LifecycleName": "studio-bootstrap",
"Description": "Bootstraps the studio space",
"Type": "studio",
"OnStartScript": "IyEvYmluL2Jhc2gKcGlwIGluc3RhbGwgLXIgL2hvbWUvZWMyLXVzZXIvcmVxdWlyZW1lbnRzLnR4dAo="
}
Success (HTTP 200)¶
Successful API response
Request / response example
{
"Message": "Successfully created Data Lab Lifecycle Configuration.",
"LifecycleId": "7c2f1b90-3d5e-4a11-9c88-0e5b7a1d2f34"
}
Errors¶
Documented error codes: IPV-1071, IPV-1045, GE-1034, IPV-1022, GE-1020.
HTTP 400
Invalid input
Type outside the allowed values
{
"Message": "IPV-1071 - Invalid value of Type, allowed values are notebook, studio"
}
Studio configuration without an on-start script
{
"Message": "IPV-1045 - Invalid parameter - OnStartScript, Studio LCC requires OnStartScript"
}
Script is not base64 encoded
{
"Message": "GE-1034 - 'OnStartScript' is not base64 encoded"
}
Script exceeds the permitted size
{
"Message": "IPV-1022 - Length of 'OnStartScript' is 20480 which is more than the permitted limit of 16384"
}
HTTP 500
Something went wrong at backend
Request / response example
{
"Message": "GE-1020 - Unable to update LifecycleConfiguration table, please retry or contact administrator"
}