Skip to content

Commit 41a85fd

Browse files
authored
Notebook Instance (Create/Delete) test (#56)
This is a pull request for the Notebook Instance, this PR contains code that will enable the creation/deletion of Notebook Instances with ACK. Create operation: Creates a notebook instance and sets the resource synced status to false until the NotebookInstance reaches the InService state(custom_set_output.go). Also fills in any unfilled values to prevent an update after creation(custom_set_delta.go). Delete Operation: Stops the notebook instance and deletes it. Notebook has to be in the “Stopped” state in order for it to be deleted. Integration test checks if creation/deletion are working correctly. Custom code: pkg/resource/notebook_instance/custom_sdk_api.go : File containing functions that call the sagemaker API pkg/resource/notebook_instance/custom_set_delta.go : Fills in default values to prevent an update after creation pkg/resource/notebook_instance/hooks.go: Handles re queuing and setting resource synced conditions. templates/notebook_instance/sdk_delete_pre_build_request.go.tpl : Stops the notebook and re queues on any state other than Stopped/Failed. Integration test files: test/e2e/resources/notebook_instance.yaml : Resource spec used for test. test/e2e/tests/test_notebook_instance.py : Integration test for notebook, creates and deletes the notebook and verifies that states were synced.
1 parent 9943ca3 commit 41a85fd

25 files changed

+2438
-15
lines changed

apis/v1alpha1/enums.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

+51-1
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,56 @@ resources:
621621
from:
622622
operation: DescribeFeatureGroup
623623
path: FeatureGroupStatus
624+
NotebookInstance:
625+
exceptions:
626+
errors:
627+
404:
628+
code: ValidationException
629+
message_prefix: RecordNotFound
630+
terminal_codes:
631+
- ResourceLimitExceeded
632+
- ResourceNotFound
633+
- ResourceInUse
634+
- OptInRequired
635+
- InvalidParameterCombination
636+
- InvalidParameterValue
637+
- MissingParameter
638+
- MissingAction
639+
- InvalidClientTokenId
640+
- InvalidQueryParameter
641+
- MalformedQueryString
642+
- InvalidAction
643+
- UnrecognizedClientException
644+
hooks:
645+
sdk_delete_pre_build_request:
646+
template_path: notebook_instance/sdk_delete_pre_build_request.go.tpl
647+
sdk_delete_post_request:
648+
template_path: common/sdk_delete_post_request.go.tpl
649+
delta_pre_compare:
650+
code: customSetDefaults(a, b)
651+
sdk_read_one_post_set_output:
652+
code: rm.customSetOutput(&resource{ko})
653+
fields:
654+
NotebookInstanceStatus:
655+
is_read_only: true
656+
print:
657+
name: STATUS
658+
from:
659+
operation: DescribeNotebookInstance
660+
path: NotebookInstanceStatus
661+
Url:
662+
is_read_only: true
663+
from:
664+
operation: DescribeNotebookInstance
665+
path: Url
666+
FailureReason:
667+
is_read_only: true
668+
print:
669+
name: FAILURE-REASON
670+
priority: 1
671+
from:
672+
operation: DescribeNotebookInstance
673+
path: FailureReason
624674
ModelPackageGroup:
625675
exceptions:
626676
errors:
@@ -689,7 +739,7 @@ ignore:
689739
# - ModelQualityJobDefinition
690740
# - MonitoringSchedule
691741
- NotebookInstanceLifecycleConfig
692-
- NotebookInstance
742+
# - NotebookInstance
693743
- Pipeline
694744
- PresignedDomainUrl
695745
- PresignedNotebookInstanceUrl

apis/v1alpha1/notebook_instance.go

+148
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/types.go

+21-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)