Skip to content

Commit d9d2744

Browse files
authored
Add terminal state for failed in modelpackage (#65)
Adds custom_update_conditions for when ModelPackage reaches a failed status will update conditions to terminal.
1 parent bb7eb30 commit d9d2744

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
ack_generate_info:
2-
build_date: "2021-07-28T17:32:05Z"
2+
build_date: "2021-07-29T18:42:38Z"
33
build_hash: c77aa9c75d944952dee198029ba9822691cd82b0
44
go_version: go1.16.4 darwin/amd64
55
version: v0.6.0
66
api_directory_checksum: c8f263a8d1a2e21f53c85b1ca5e2be3687045dd0
77
api_version: v1alpha1
88
aws_sdk_go_version: ""
99
generator_config_info:
10-
file_checksum: 4ee70768543fda4822f58faba02cab8b06ddb831
10+
file_checksum: 7ee0dc6d120dcdf6aee16ff401865577e3f783cb
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation
14-
timestamp: 2021-07-28 17:32:22.546031 +0000 UTC
14+
timestamp: 2021-07-29 18:42:48.11324 +0000 UTC

generator.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ resources:
500500
operation: DescribeMonitoringSchedule
501501
path: LastMonitoringExecutionSummary
502502
ModelPackage:
503+
update_conditions_custom_method_name: CustomUpdateConditions
503504
exceptions:
504505
errors:
505506
404:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License"). You may
4+
// not use this file except in compliance with the License. A copy of the
5+
// License is located at
6+
//
7+
// http://aws.amazon.com/apache2.0/
8+
//
9+
// or in the "license" file accompanying this file. This file is distributed
10+
// on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
11+
// express or implied. See the License for the specific language governing
12+
// permissions and limitations under the License.
13+
14+
package model_package
15+
16+
import (
17+
svcapitypes "github.com/aws-controllers-k8s/sagemaker-controller/apis/v1alpha1"
18+
svccommon "github.com/aws-controllers-k8s/sagemaker-controller/pkg/common"
19+
svcsdk "github.com/aws/aws-sdk-go/service/sagemaker"
20+
)
21+
22+
// CustomUpdateConditions sets conditions (terminal) on supplied model package.
23+
// it examines supplied resource to determine conditions.
24+
// It returns true if conditions are updated.
25+
func (rm *resourceManager) CustomUpdateConditions(
26+
ko *svcapitypes.ModelPackage,
27+
r *resource,
28+
err error,
29+
) bool {
30+
latestStatus := r.ko.Status.ModelPackageStatus
31+
terminalStatus := svcsdk.ModelPackageStatusFailed
32+
conditionManager := &resource{ko}
33+
// If the latestStatus == terminalStatus we will set
34+
// the terminal condition and terminal message.
35+
return svccommon.SetTerminalState(conditionManager, latestStatus, &resourceName, terminalStatus)
36+
}

pkg/resource/model_package/sdk.go

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)