This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
/
trainingjob_types.go
138 lines (98 loc) · 5.43 KB
/
trainingjob_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This annotation signals to the generator that there are types in this file
// that need DeepCopy methods.
// +kubebuilder:object:generate=true
// This annotation signals that the types in this file should be a CRD in the group.
// +groupName=sagemaker.aws.amazon.com
package v1
import (
commonv1 "github.com/aws/amazon-sagemaker-operator-for-k8s/api/v1/common"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// TrainingJobSpec defines the desired state of TrainingJob
type TrainingJobSpec struct {
AlgorithmSpecification *commonv1.AlgorithmSpecification `json:"algorithmSpecification"`
EnableInterContainerTrafficEncryption *bool `json:"enableInterContainerTrafficEncryption,omitempty"`
EnableNetworkIsolation *bool `json:"enableNetworkIsolation,omitempty"`
EnableManagedSpotTraining *bool `json:"enableManagedSpotTraining,omitempty"`
HyperParameters []*commonv1.KeyValuePair `json:"hyperParameters,omitempty"`
// +kubebuilder:validation:MinItems=1
InputDataConfig []commonv1.Channel `json:"inputDataConfig,omitempty"`
OutputDataConfig *commonv1.OutputDataConfig `json:"outputDataConfig"`
CheckpointConfig *commonv1.CheckpointConfig `json:"checkpointConfig,omitempty"`
ResourceConfig *commonv1.ResourceConfig `json:"resourceConfig"`
// +kubebuilder:validation:MinLength=20
RoleArn *string `json:"roleArn"`
// +kubebuilder:validation:MinLength=1
Region *string `json:"region"`
// A custom SageMaker endpoint to use when communicating with SageMaker.
// +kubebuilder:validation:Pattern="^(https|http)://.*$"
SageMakerEndpoint *string `json:"sageMakerEndpoint,omitempty"`
StoppingCondition *commonv1.StoppingCondition `json:"stoppingCondition"`
DebugRuleConfigurations []*commonv1.DebugRuleConfiguration `json:"debugRuleConfigurations,omitempty"`
DebugHookConfig *commonv1.DebugHookConfig `json:"debugHookConfig,omitempty"`
TensorBoardOutputConfig *commonv1.TensorBoardOutputConfig `json:"tensorBoardOutputConfig,omitempty"`
Tags []commonv1.Tag `json:"tags,omitempty"`
// The SageMaker training job name. This is optional for the SageMaker K8s operator. If it is empty,
// the operator will populate it with a generated name.
// +kubebuilder:validation:MaxLength=63
TrainingJobName *string `json:"trainingJobName,omitempty"`
VpcConfig *commonv1.VpcConfig `json:"vpcConfig,omitempty"`
}
// TrainingJobStatus defines the observed state of TrainingJob
type TrainingJobStatus struct {
// The status of the training job.
// https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeTrainingJob.html#SageMaker-DescribeTrainingJob-response-TrainingJobStatus
TrainingJobStatus string `json:"trainingJobStatus,omitempty"`
// The secondary, more granular status of the training job.
// https://docs.aws.amazon.com/sagemaker/latest/dg/API_DescribeTrainingJob.html#SageMaker-DescribeTrainingJob-response-SecondaryStatus
SecondaryStatus string `json:"secondaryStatus,omitempty"`
// Field to store additional information, for example if
// we are unable to check the status we update this.
Additional string `json:"additional,omitempty"`
// The last time that we checked the status of the SageMaker job.
LastCheckTime *metav1.Time `json:"lastCheckTime,omitempty"`
// Cloud Watch url for training log
CloudWatchLogUrl string `json:"cloudWatchLogUrl,omitempty"`
//SageMaker training job name
SageMakerTrainingJobName string `json:"sageMakerTrainingJobName,omitempty"`
//Full path to the training artifact (model)
ModelPath string `json:"modelPath,omitempty"`
// Status of rule evaluation jobs, obtained from DebugRuleEvaluationStatuses.
// https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_DescribeTrainingJob.html#sagemaker-DescribeTrainingJob-response-DebugRuleEvaluationStatuses
DebugRuleEvaluationStatuses []commonv1.DebugRuleEvaluationStatus `json:"debugRuleEvaluationStatuses,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Status",type="string", JSONPath=".status.trainingJobStatus"
// +kubebuilder:printcolumn:name="Secondary-Status",type="string", JSONPath=".status.secondaryStatus"
// +kubebuilder:printcolumn:name="Creation-Time",type="string", format="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="Sagemaker-Job-Name",type="string", JSONPath=".status.sageMakerTrainingJobName"
// TrainingJob is the Schema for the trainingjobs API
type TrainingJob struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec TrainingJobSpec `json:"spec"`
Status TrainingJobStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// TrainingJobList contains a list of TrainingJob
type TrainingJobList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []TrainingJob `json:"items"`
}
func init() {
commonv1.SchemeBuilder.Register(&TrainingJob{}, &TrainingJobList{})
}