/
trial.go
224 lines (187 loc) · 8.65 KB
/
trial.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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Adds a user provided trial to a study.
// Auto-naming is currently not supported for this resource.
type Trial struct {
pulumi.CustomResourceState
// The identifier of the client that originally requested this trial.
ClientId pulumi.StringOutput `pulumi:"clientId"`
// Time at which the trial's status changed to COMPLETED.
EndTime pulumi.StringOutput `pulumi:"endTime"`
// The final measurement containing the objective value.
FinalMeasurement GoogleCloudMlV1__MeasurementResponseOutput `pulumi:"finalMeasurement"`
// A human readable string describing why the trial is infeasible. This should only be set if trial_infeasible is true.
InfeasibleReason pulumi.StringOutput `pulumi:"infeasibleReason"`
Location pulumi.StringOutput `pulumi:"location"`
// A list of measurements that are strictly lexicographically ordered by their induced tuples (steps, elapsed_time). These are used for early stopping computations.
Measurements GoogleCloudMlV1__MeasurementResponseArrayOutput `pulumi:"measurements"`
// Name of the trial assigned by the service.
Name pulumi.StringOutput `pulumi:"name"`
// The parameters of the trial.
Parameters GoogleCloudMlV1_Trial_ParameterResponseArrayOutput `pulumi:"parameters"`
Project pulumi.StringOutput `pulumi:"project"`
// Time at which the trial was started.
StartTime pulumi.StringOutput `pulumi:"startTime"`
// The detailed state of a trial.
State pulumi.StringOutput `pulumi:"state"`
StudyId pulumi.StringOutput `pulumi:"studyId"`
// If true, the parameters in this trial are not attempted again.
TrialInfeasible pulumi.BoolOutput `pulumi:"trialInfeasible"`
}
// NewTrial registers a new resource with the given unique name, arguments, and options.
func NewTrial(ctx *pulumi.Context,
name string, args *TrialArgs, opts ...pulumi.ResourceOption) (*Trial, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.StudyId == nil {
return nil, errors.New("invalid value for required argument 'StudyId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"location",
"project",
"studyId",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Trial
err := ctx.RegisterResource("google-native:ml/v1:Trial", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTrial gets an existing Trial resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetTrial(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TrialState, opts ...pulumi.ResourceOption) (*Trial, error) {
var resource Trial
err := ctx.ReadResource("google-native:ml/v1:Trial", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Trial resources.
type trialState struct {
}
type TrialState struct {
}
func (TrialState) ElementType() reflect.Type {
return reflect.TypeOf((*trialState)(nil)).Elem()
}
type trialArgs struct {
// The final measurement containing the objective value.
FinalMeasurement *GoogleCloudMlV1__Measurement `pulumi:"finalMeasurement"`
Location *string `pulumi:"location"`
// A list of measurements that are strictly lexicographically ordered by their induced tuples (steps, elapsed_time). These are used for early stopping computations.
Measurements []GoogleCloudMlV1__Measurement `pulumi:"measurements"`
// The parameters of the trial.
Parameters []GoogleCloudMlV1_Trial_Parameter `pulumi:"parameters"`
Project *string `pulumi:"project"`
// The detailed state of a trial.
State *TrialStateEnum `pulumi:"state"`
StudyId string `pulumi:"studyId"`
}
// The set of arguments for constructing a Trial resource.
type TrialArgs struct {
// The final measurement containing the objective value.
FinalMeasurement GoogleCloudMlV1__MeasurementPtrInput
Location pulumi.StringPtrInput
// A list of measurements that are strictly lexicographically ordered by their induced tuples (steps, elapsed_time). These are used for early stopping computations.
Measurements GoogleCloudMlV1__MeasurementArrayInput
// The parameters of the trial.
Parameters GoogleCloudMlV1_Trial_ParameterArrayInput
Project pulumi.StringPtrInput
// The detailed state of a trial.
State TrialStateEnumPtrInput
StudyId pulumi.StringInput
}
func (TrialArgs) ElementType() reflect.Type {
return reflect.TypeOf((*trialArgs)(nil)).Elem()
}
type TrialInput interface {
pulumi.Input
ToTrialOutput() TrialOutput
ToTrialOutputWithContext(ctx context.Context) TrialOutput
}
func (*Trial) ElementType() reflect.Type {
return reflect.TypeOf((**Trial)(nil)).Elem()
}
func (i *Trial) ToTrialOutput() TrialOutput {
return i.ToTrialOutputWithContext(context.Background())
}
func (i *Trial) ToTrialOutputWithContext(ctx context.Context) TrialOutput {
return pulumi.ToOutputWithContext(ctx, i).(TrialOutput)
}
type TrialOutput struct{ *pulumi.OutputState }
func (TrialOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Trial)(nil)).Elem()
}
func (o TrialOutput) ToTrialOutput() TrialOutput {
return o
}
func (o TrialOutput) ToTrialOutputWithContext(ctx context.Context) TrialOutput {
return o
}
// The identifier of the client that originally requested this trial.
func (o TrialOutput) ClientId() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.ClientId }).(pulumi.StringOutput)
}
// Time at which the trial's status changed to COMPLETED.
func (o TrialOutput) EndTime() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.EndTime }).(pulumi.StringOutput)
}
// The final measurement containing the objective value.
func (o TrialOutput) FinalMeasurement() GoogleCloudMlV1__MeasurementResponseOutput {
return o.ApplyT(func(v *Trial) GoogleCloudMlV1__MeasurementResponseOutput { return v.FinalMeasurement }).(GoogleCloudMlV1__MeasurementResponseOutput)
}
// A human readable string describing why the trial is infeasible. This should only be set if trial_infeasible is true.
func (o TrialOutput) InfeasibleReason() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.InfeasibleReason }).(pulumi.StringOutput)
}
func (o TrialOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// A list of measurements that are strictly lexicographically ordered by their induced tuples (steps, elapsed_time). These are used for early stopping computations.
func (o TrialOutput) Measurements() GoogleCloudMlV1__MeasurementResponseArrayOutput {
return o.ApplyT(func(v *Trial) GoogleCloudMlV1__MeasurementResponseArrayOutput { return v.Measurements }).(GoogleCloudMlV1__MeasurementResponseArrayOutput)
}
// Name of the trial assigned by the service.
func (o TrialOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The parameters of the trial.
func (o TrialOutput) Parameters() GoogleCloudMlV1_Trial_ParameterResponseArrayOutput {
return o.ApplyT(func(v *Trial) GoogleCloudMlV1_Trial_ParameterResponseArrayOutput { return v.Parameters }).(GoogleCloudMlV1_Trial_ParameterResponseArrayOutput)
}
func (o TrialOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// Time at which the trial was started.
func (o TrialOutput) StartTime() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.StartTime }).(pulumi.StringOutput)
}
// The detailed state of a trial.
func (o TrialOutput) State() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.State }).(pulumi.StringOutput)
}
func (o TrialOutput) StudyId() pulumi.StringOutput {
return o.ApplyT(func(v *Trial) pulumi.StringOutput { return v.StudyId }).(pulumi.StringOutput)
}
// If true, the parameters in this trial are not attempted again.
func (o TrialOutput) TrialInfeasible() pulumi.BoolOutput {
return o.ApplyT(func(v *Trial) pulumi.BoolOutput { return v.TrialInfeasible }).(pulumi.BoolOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TrialInput)(nil)).Elem(), &Trial{})
pulumi.RegisterOutputType(TrialOutput{})
}