This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
/
job.go
402 lines (378 loc) · 23.5 KB
/
job.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20180301
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Contains information about the job.
type Job struct {
pulumi.CustomResourceState
// Specifies the settings for Caffe job.
CaffeSettings CaffeSettingsResponsePtrOutput `pulumi:"caffeSettings"`
// Specifies the settings for Chainer job.
ChainerSettings ChainerSettingsResponsePtrOutput `pulumi:"chainerSettings"`
// Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.
Cluster ResourceIdResponsePtrOutput `pulumi:"cluster"`
// Specifies the settings for CNTK (aka Microsoft Cognitive Toolkit) job.
CntkSettings CNTKsettingsResponsePtrOutput `pulumi:"cntkSettings"`
// Constraints associated with the Job.
Constraints JobPropertiesResponseConstraintsPtrOutput `pulumi:"constraints"`
// If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM.
ContainerSettings ContainerSettingsResponsePtrOutput `pulumi:"containerSettings"`
// The creation time of the job.
CreationTime pulumi.StringOutput `pulumi:"creationTime"`
// Specifies the settings for a custom tool kit job.
CustomToolkitSettings CustomToolkitSettingsResponsePtrOutput `pulumi:"customToolkitSettings"`
// Batch AI will setup these additional environment variables for the job.
EnvironmentVariables EnvironmentVariableResponseArrayOutput `pulumi:"environmentVariables"`
// Contains information about the execution of a job in the Azure Batch service.
ExecutionInfo JobPropertiesResponseExecutionInfoPtrOutput `pulumi:"executionInfo"`
// The current state of the job. Possible values are: queued - The job is queued and able to run. A job enters this state when it is created, or when it is awaiting a retry after a failed run. running - The job is running on a compute cluster. This includes job-level preparation such as downloading resource files or set up container specified on the job - it does not necessarily mean that the job command line has started executing. terminating - The job is terminated by the user, the terminate operation is in progress. succeeded - The job has completed running successfully and exited with exit code 0. failed - The job has finished unsuccessfully (failed with a non-zero exit code) and has exhausted its retry limit. A job is also marked as failed if an error occurred launching the job.
ExecutionState pulumi.StringPtrOutput `pulumi:"executionState"`
// The time at which the job entered its current execution state.
ExecutionStateTransitionTime pulumi.StringOutput `pulumi:"executionStateTransitionTime"`
// Describe the experiment information of the job
ExperimentName pulumi.StringPtrOutput `pulumi:"experimentName"`
InputDirectories InputDirectoryResponseArrayOutput `pulumi:"inputDirectories"`
// Batch AI creates job's output directories under an unique path to avoid conflicts between jobs. This value contains a path segment generated by Batch AI to make the path unique and can be used to find the output directory on the node or mounted filesystem.
JobOutputDirectoryPathSegment pulumi.StringPtrOutput `pulumi:"jobOutputDirectoryPathSegment"`
// The specified actions will run on all the nodes that are part of the job
JobPreparation JobPreparationResponsePtrOutput `pulumi:"jobPreparation"`
// The location of the resource
Location pulumi.StringOutput `pulumi:"location"`
// These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable.
MountVolumes MountVolumesResponsePtrOutput `pulumi:"mountVolumes"`
// The name of the resource
Name pulumi.StringOutput `pulumi:"name"`
// The job will be gang scheduled on that many compute nodes
NodeCount pulumi.IntPtrOutput `pulumi:"nodeCount"`
OutputDirectories OutputDirectoryResponseArrayOutput `pulumi:"outputDirectories"`
// Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.
Priority pulumi.IntPtrOutput `pulumi:"priority"`
// The provisioned state of the Batch AI job
ProvisioningState pulumi.StringOutput `pulumi:"provisioningState"`
// The time at which the job entered its current provisioning state.
ProvisioningStateTransitionTime pulumi.StringOutput `pulumi:"provisioningStateTransitionTime"`
// Specifies the settings for pyTorch job.
PyTorchSettings PyTorchSettingsResponsePtrOutput `pulumi:"pyTorchSettings"`
// Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back.
Secrets EnvironmentVariableWithSecretValueResponseArrayOutput `pulumi:"secrets"`
// The path where the Batch AI service will upload stdout and stderror of the job.
StdOutErrPathPrefix pulumi.StringPtrOutput `pulumi:"stdOutErrPathPrefix"`
// The tags of the resource
Tags pulumi.StringMapOutput `pulumi:"tags"`
// Specifies the settings for TensorFlow job.
TensorFlowSettings TensorFlowSettingsResponsePtrOutput `pulumi:"tensorFlowSettings"`
// Possible values are: cntk, tensorflow, caffe, caffe2, chainer, pytorch, custom.
ToolType pulumi.StringPtrOutput `pulumi:"toolType"`
// The type of the resource
Type pulumi.StringOutput `pulumi:"type"`
}
// NewJob registers a new resource with the given unique name, arguments, and options.
func NewJob(ctx *pulumi.Context,
name string, args *JobArgs, opts ...pulumi.ResourceOption) (*Job, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Cluster == nil {
return nil, errors.New("invalid value for required argument 'Cluster'")
}
if args.JobName == nil {
return nil, errors.New("invalid value for required argument 'JobName'")
}
if args.NodeCount == nil {
return nil, errors.New("invalid value for required argument 'NodeCount'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.StdOutErrPathPrefix == nil {
return nil, errors.New("invalid value for required argument 'StdOutErrPathPrefix'")
}
if args.Priority == nil {
args.Priority = pulumi.IntPtr(0)
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("azure-nextgen:batchai/v20170901preview:Job"),
},
})
opts = append(opts, aliases)
var resource Job
err := ctx.RegisterResource("azure-nextgen:batchai/v20180301:Job", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetJob gets an existing Job 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 GetJob(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *JobState, opts ...pulumi.ResourceOption) (*Job, error) {
var resource Job
err := ctx.ReadResource("azure-nextgen:batchai/v20180301:Job", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Job resources.
type jobState struct {
// Specifies the settings for Caffe job.
CaffeSettings *CaffeSettingsResponse `pulumi:"caffeSettings"`
// Specifies the settings for Chainer job.
ChainerSettings *ChainerSettingsResponse `pulumi:"chainerSettings"`
// Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.
Cluster *ResourceIdResponse `pulumi:"cluster"`
// Specifies the settings for CNTK (aka Microsoft Cognitive Toolkit) job.
CntkSettings *CNTKsettingsResponse `pulumi:"cntkSettings"`
// Constraints associated with the Job.
Constraints *JobPropertiesResponseConstraints `pulumi:"constraints"`
// If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM.
ContainerSettings *ContainerSettingsResponse `pulumi:"containerSettings"`
// The creation time of the job.
CreationTime *string `pulumi:"creationTime"`
// Specifies the settings for a custom tool kit job.
CustomToolkitSettings *CustomToolkitSettingsResponse `pulumi:"customToolkitSettings"`
// Batch AI will setup these additional environment variables for the job.
EnvironmentVariables []EnvironmentVariableResponse `pulumi:"environmentVariables"`
// Contains information about the execution of a job in the Azure Batch service.
ExecutionInfo *JobPropertiesResponseExecutionInfo `pulumi:"executionInfo"`
// The current state of the job. Possible values are: queued - The job is queued and able to run. A job enters this state when it is created, or when it is awaiting a retry after a failed run. running - The job is running on a compute cluster. This includes job-level preparation such as downloading resource files or set up container specified on the job - it does not necessarily mean that the job command line has started executing. terminating - The job is terminated by the user, the terminate operation is in progress. succeeded - The job has completed running successfully and exited with exit code 0. failed - The job has finished unsuccessfully (failed with a non-zero exit code) and has exhausted its retry limit. A job is also marked as failed if an error occurred launching the job.
ExecutionState *string `pulumi:"executionState"`
// The time at which the job entered its current execution state.
ExecutionStateTransitionTime *string `pulumi:"executionStateTransitionTime"`
// Describe the experiment information of the job
ExperimentName *string `pulumi:"experimentName"`
InputDirectories []InputDirectoryResponse `pulumi:"inputDirectories"`
// Batch AI creates job's output directories under an unique path to avoid conflicts between jobs. This value contains a path segment generated by Batch AI to make the path unique and can be used to find the output directory on the node or mounted filesystem.
JobOutputDirectoryPathSegment *string `pulumi:"jobOutputDirectoryPathSegment"`
// The specified actions will run on all the nodes that are part of the job
JobPreparation *JobPreparationResponse `pulumi:"jobPreparation"`
// The location of the resource
Location *string `pulumi:"location"`
// These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable.
MountVolumes *MountVolumesResponse `pulumi:"mountVolumes"`
// The name of the resource
Name *string `pulumi:"name"`
// The job will be gang scheduled on that many compute nodes
NodeCount *int `pulumi:"nodeCount"`
OutputDirectories []OutputDirectoryResponse `pulumi:"outputDirectories"`
// Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.
Priority *int `pulumi:"priority"`
// The provisioned state of the Batch AI job
ProvisioningState *string `pulumi:"provisioningState"`
// The time at which the job entered its current provisioning state.
ProvisioningStateTransitionTime *string `pulumi:"provisioningStateTransitionTime"`
// Specifies the settings for pyTorch job.
PyTorchSettings *PyTorchSettingsResponse `pulumi:"pyTorchSettings"`
// Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back.
Secrets []EnvironmentVariableWithSecretValueResponse `pulumi:"secrets"`
// The path where the Batch AI service will upload stdout and stderror of the job.
StdOutErrPathPrefix *string `pulumi:"stdOutErrPathPrefix"`
// The tags of the resource
Tags map[string]string `pulumi:"tags"`
// Specifies the settings for TensorFlow job.
TensorFlowSettings *TensorFlowSettingsResponse `pulumi:"tensorFlowSettings"`
// Possible values are: cntk, tensorflow, caffe, caffe2, chainer, pytorch, custom.
ToolType *string `pulumi:"toolType"`
// The type of the resource
Type *string `pulumi:"type"`
}
type JobState struct {
// Specifies the settings for Caffe job.
CaffeSettings CaffeSettingsResponsePtrInput
// Specifies the settings for Chainer job.
ChainerSettings ChainerSettingsResponsePtrInput
// Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.
Cluster ResourceIdResponsePtrInput
// Specifies the settings for CNTK (aka Microsoft Cognitive Toolkit) job.
CntkSettings CNTKsettingsResponsePtrInput
// Constraints associated with the Job.
Constraints JobPropertiesResponseConstraintsPtrInput
// If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM.
ContainerSettings ContainerSettingsResponsePtrInput
// The creation time of the job.
CreationTime pulumi.StringPtrInput
// Specifies the settings for a custom tool kit job.
CustomToolkitSettings CustomToolkitSettingsResponsePtrInput
// Batch AI will setup these additional environment variables for the job.
EnvironmentVariables EnvironmentVariableResponseArrayInput
// Contains information about the execution of a job in the Azure Batch service.
ExecutionInfo JobPropertiesResponseExecutionInfoPtrInput
// The current state of the job. Possible values are: queued - The job is queued and able to run. A job enters this state when it is created, or when it is awaiting a retry after a failed run. running - The job is running on a compute cluster. This includes job-level preparation such as downloading resource files or set up container specified on the job - it does not necessarily mean that the job command line has started executing. terminating - The job is terminated by the user, the terminate operation is in progress. succeeded - The job has completed running successfully and exited with exit code 0. failed - The job has finished unsuccessfully (failed with a non-zero exit code) and has exhausted its retry limit. A job is also marked as failed if an error occurred launching the job.
ExecutionState pulumi.StringPtrInput
// The time at which the job entered its current execution state.
ExecutionStateTransitionTime pulumi.StringPtrInput
// Describe the experiment information of the job
ExperimentName pulumi.StringPtrInput
InputDirectories InputDirectoryResponseArrayInput
// Batch AI creates job's output directories under an unique path to avoid conflicts between jobs. This value contains a path segment generated by Batch AI to make the path unique and can be used to find the output directory on the node or mounted filesystem.
JobOutputDirectoryPathSegment pulumi.StringPtrInput
// The specified actions will run on all the nodes that are part of the job
JobPreparation JobPreparationResponsePtrInput
// The location of the resource
Location pulumi.StringPtrInput
// These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable.
MountVolumes MountVolumesResponsePtrInput
// The name of the resource
Name pulumi.StringPtrInput
// The job will be gang scheduled on that many compute nodes
NodeCount pulumi.IntPtrInput
OutputDirectories OutputDirectoryResponseArrayInput
// Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.
Priority pulumi.IntPtrInput
// The provisioned state of the Batch AI job
ProvisioningState pulumi.StringPtrInput
// The time at which the job entered its current provisioning state.
ProvisioningStateTransitionTime pulumi.StringPtrInput
// Specifies the settings for pyTorch job.
PyTorchSettings PyTorchSettingsResponsePtrInput
// Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back.
Secrets EnvironmentVariableWithSecretValueResponseArrayInput
// The path where the Batch AI service will upload stdout and stderror of the job.
StdOutErrPathPrefix pulumi.StringPtrInput
// The tags of the resource
Tags pulumi.StringMapInput
// Specifies the settings for TensorFlow job.
TensorFlowSettings TensorFlowSettingsResponsePtrInput
// Possible values are: cntk, tensorflow, caffe, caffe2, chainer, pytorch, custom.
ToolType pulumi.StringPtrInput
// The type of the resource
Type pulumi.StringPtrInput
}
func (JobState) ElementType() reflect.Type {
return reflect.TypeOf((*jobState)(nil)).Elem()
}
type jobArgs struct {
// Specifies the settings for Caffe2 job.
Caffe2Settings *Caffe2Settings `pulumi:"caffe2Settings"`
// Specifies the settings for Caffe job.
CaffeSettings *CaffeSettings `pulumi:"caffeSettings"`
// Specifies the settings for Chainer job.
ChainerSettings *ChainerSettings `pulumi:"chainerSettings"`
// Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.
Cluster ResourceId `pulumi:"cluster"`
// Specifies the settings for CNTK (aka Microsoft Cognitive Toolkit) job.
CntkSettings *CNTKsettings `pulumi:"cntkSettings"`
// Constraints associated with the Job.
Constraints *JobBasePropertiesConstraints `pulumi:"constraints"`
// If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM.
ContainerSettings *ContainerSettings `pulumi:"containerSettings"`
// Specifies the settings for a custom tool kit job.
CustomToolkitSettings *CustomToolkitSettings `pulumi:"customToolkitSettings"`
// Batch AI will setup these additional environment variables for the job.
EnvironmentVariables []EnvironmentVariable `pulumi:"environmentVariables"`
// Describe the experiment information of the job
ExperimentName *string `pulumi:"experimentName"`
InputDirectories []InputDirectory `pulumi:"inputDirectories"`
// The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
JobName string `pulumi:"jobName"`
// The specified actions will run on all the nodes that are part of the job
JobPreparation *JobPreparation `pulumi:"jobPreparation"`
// The region in which to create the job.
Location *string `pulumi:"location"`
// These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable.
MountVolumes *MountVolumes `pulumi:"mountVolumes"`
// The job will be gang scheduled on that many compute nodes
NodeCount int `pulumi:"nodeCount"`
OutputDirectories []OutputDirectory `pulumi:"outputDirectories"`
// Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.
Priority *int `pulumi:"priority"`
// Specifies the settings for pyTorch job.
PyTorchSettings *PyTorchSettings `pulumi:"pyTorchSettings"`
// Name of the resource group to which the resource belongs.
ResourceGroupName string `pulumi:"resourceGroupName"`
// Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back.
Secrets []EnvironmentVariableWithSecretValue `pulumi:"secrets"`
// The path where the Batch AI service will upload stdout and stderror of the job.
StdOutErrPathPrefix string `pulumi:"stdOutErrPathPrefix"`
// The user specified tags associated with the job.
Tags map[string]string `pulumi:"tags"`
// Specifies the settings for TensorFlow job.
TensorFlowSettings *TensorFlowSettings `pulumi:"tensorFlowSettings"`
}
// The set of arguments for constructing a Job resource.
type JobArgs struct {
// Specifies the settings for Caffe2 job.
Caffe2Settings Caffe2SettingsPtrInput
// Specifies the settings for Caffe job.
CaffeSettings CaffeSettingsPtrInput
// Specifies the settings for Chainer job.
ChainerSettings ChainerSettingsPtrInput
// Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet.
Cluster ResourceIdInput
// Specifies the settings for CNTK (aka Microsoft Cognitive Toolkit) job.
CntkSettings CNTKsettingsPtrInput
// Constraints associated with the Job.
Constraints JobBasePropertiesConstraintsPtrInput
// If the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM.
ContainerSettings ContainerSettingsPtrInput
// Specifies the settings for a custom tool kit job.
CustomToolkitSettings CustomToolkitSettingsPtrInput
// Batch AI will setup these additional environment variables for the job.
EnvironmentVariables EnvironmentVariableArrayInput
// Describe the experiment information of the job
ExperimentName pulumi.StringPtrInput
InputDirectories InputDirectoryArrayInput
// The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
JobName pulumi.StringInput
// The specified actions will run on all the nodes that are part of the job
JobPreparation JobPreparationPtrInput
// The region in which to create the job.
Location pulumi.StringPtrInput
// These volumes will be mounted before the job execution and will be unmounted after the job completion. The volumes will be mounted at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable.
MountVolumes MountVolumesPtrInput
// The job will be gang scheduled on that many compute nodes
NodeCount pulumi.IntInput
OutputDirectories OutputDirectoryArrayInput
// Priority associated with the job. Priority values can range from -1000 to 1000, with -1000 being the lowest priority and 1000 being the highest priority. The default value is 0.
Priority pulumi.IntPtrInput
// Specifies the settings for pyTorch job.
PyTorchSettings PyTorchSettingsPtrInput
// Name of the resource group to which the resource belongs.
ResourceGroupName pulumi.StringInput
// Batch AI will setup these additional environment variables for the job. Server will never report values of these variables back.
Secrets EnvironmentVariableWithSecretValueArrayInput
// The path where the Batch AI service will upload stdout and stderror of the job.
StdOutErrPathPrefix pulumi.StringInput
// The user specified tags associated with the job.
Tags pulumi.StringMapInput
// Specifies the settings for TensorFlow job.
TensorFlowSettings TensorFlowSettingsPtrInput
}
func (JobArgs) ElementType() reflect.Type {
return reflect.TypeOf((*jobArgs)(nil)).Elem()
}
type JobInput interface {
pulumi.Input
ToJobOutput() JobOutput
ToJobOutputWithContext(ctx context.Context) JobOutput
}
func (*Job) ElementType() reflect.Type {
return reflect.TypeOf((*Job)(nil))
}
func (i *Job) ToJobOutput() JobOutput {
return i.ToJobOutputWithContext(context.Background())
}
func (i *Job) ToJobOutputWithContext(ctx context.Context) JobOutput {
return pulumi.ToOutputWithContext(ctx, i).(JobOutput)
}
type JobOutput struct {
*pulumi.OutputState
}
func (JobOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Job)(nil))
}
func (o JobOutput) ToJobOutput() JobOutput {
return o
}
func (o JobOutput) ToJobOutputWithContext(ctx context.Context) JobOutput {
return o
}
func init() {
pulumi.RegisterOutputType(JobOutput{})
}