Skip to content

Commit b435c06

Browse files
authored
Handle server side default for inputDataConfig in TrainingJob (#168)
Bug fix for unhandled case in training job. `inputDataConfig` is an optional field. Its default value is an empty list. Without this hook, the controller reconciles because of diff between null(desired) and empty list(observed) when `inputDataConfig` is not specified - usecase: If user bundles the dataset and training code into the training image or downloads dataset at runtime By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 553f3a4 commit b435c06

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ack_generate_info:
2-
build_date: "2022-08-17T23:24:33Z"
2+
build_date: "2022-08-18T06:59:27Z"
33
build_hash: fe61d04673fd4d9848d5f726b01e0689a16d3733
4-
go_version: go1.17.1
4+
go_version: go1.17.13
55
version: v0.19.3-1-gfe61d04
66
api_directory_checksum: 8b3c128d2037d5227679cccb57cd4d78af6aed1b
77
api_version: v1alpha1

pkg/resource/training_job/custom_delta.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ package training_job
1515

1616
import (
1717
ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare"
18+
svcapitypes "github.com/aws-controllers-k8s/sagemaker-controller/apis/v1alpha1"
1819
"github.com/aws/aws-sdk-go/aws"
1920
)
2021

@@ -46,6 +47,11 @@ func customSetDefaults(
4647
// Default value of RecordWrapperType is None
4748
defaultRecordWrapperType := aws.String("None")
4849

50+
// inputDataConfig is an optional field. Its default value is an empty list
51+
if ackcompare.IsNil(a.ko.Spec.InputDataConfig) && ackcompare.IsNotNil(b.ko.Spec.InputDataConfig) {
52+
a.ko.Spec.InputDataConfig = []*svcapitypes.Channel{}
53+
}
54+
4955
if ackcompare.IsNotNil(a.ko.Spec.InputDataConfig) && ackcompare.IsNotNil(b.ko.Spec.InputDataConfig) {
5056
for index := range a.ko.Spec.InputDataConfig {
5157
if ackcompare.IsNil(a.ko.Spec.InputDataConfig[index].RecordWrapperType) && ackcompare.IsNotNil(b.ko.Spec.InputDataConfig[index].RecordWrapperType) {

0 commit comments

Comments
 (0)