Notebook Lifecycle Config create, describe and delete (#3417)
* Notebook Lifecycle Config create, describe and delete * PR3417 comment changes: raise on create with duplicate name, derive a ValidationException class and use it instead of RESTException, unit test for delete non-existing. Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
This commit is contained in:
parent
cbd4efb42d
commit
f8d2ce2e6a
4 changed files with 220 additions and 94 deletions
|
|
@ -239,3 +239,38 @@ class SageMakerResponse(BaseResponse):
|
|||
training_job_name = self._get_param("TrainingJobName")
|
||||
self.sagemaker_backend.delete_training_job(training_job_name)
|
||||
return 200, {}, json.dumps("{}")
|
||||
|
||||
@amzn_request_id
|
||||
def create_notebook_instance_lifecycle_config(self):
|
||||
try:
|
||||
lifecycle_configuration = self.sagemaker_backend.create_notebook_instance_lifecycle_config(
|
||||
notebook_instance_lifecycle_config_name=self._get_param(
|
||||
"NotebookInstanceLifecycleConfigName"
|
||||
),
|
||||
on_create=self._get_param("OnCreate"),
|
||||
on_start=self._get_param("OnStart"),
|
||||
)
|
||||
response = {
|
||||
"NotebookInstanceLifecycleConfigArn": lifecycle_configuration.notebook_instance_lifecycle_config_arn,
|
||||
}
|
||||
return 200, {}, json.dumps(response)
|
||||
except AWSError as err:
|
||||
return err.response()
|
||||
|
||||
@amzn_request_id
|
||||
def describe_notebook_instance_lifecycle_config(self):
|
||||
response = self.sagemaker_backend.describe_notebook_instance_lifecycle_config(
|
||||
notebook_instance_lifecycle_config_name=self._get_param(
|
||||
"NotebookInstanceLifecycleConfigName"
|
||||
)
|
||||
)
|
||||
return json.dumps(response)
|
||||
|
||||
@amzn_request_id
|
||||
def delete_notebook_instance_lifecycle_config(self):
|
||||
self.sagemaker_backend.delete_notebook_instance_lifecycle_config(
|
||||
notebook_instance_lifecycle_config_name=self._get_param(
|
||||
"NotebookInstanceLifecycleConfigName"
|
||||
)
|
||||
)
|
||||
return 200, {}, json.dumps("{}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue