-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathjob.py
More file actions
214 lines (206 loc) · 12.7 KB
/
job.py
File metadata and controls
214 lines (206 loc) · 12.7 KB
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
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from .proxy_resource import ProxyResource
class Job(ProxyResource):
"""Information about a Job.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The ID of the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:param scheduling_priority: Scheduling priority. Scheduling priority
associated with the job. Possible values include: 'low', 'normal', 'high'.
Default value: "normal" .
:type scheduling_priority: str or ~azure.mgmt.batchai.models.JobPriority
:param cluster: Cluster. Resource ID of the cluster associated with the
job.
:type cluster: ~azure.mgmt.batchai.models.ResourceId
:param mount_volumes: Mount volumes. Collection of mount volumes available
to the job during execution. These volumes are mounted before the job
execution and unmouted after the job completion. The volumes are mounted
at location specified by $AZ_BATCHAI_JOB_MOUNT_ROOT environment variable.
:type mount_volumes: ~azure.mgmt.batchai.models.MountVolumes
:param node_count: Number of compute nodes to run the job on. The job will
be gang scheduled on that many compute nodes
:type node_count: int
:param container_settings: If provided the job will run in the specified
container. 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.
:type container_settings: ~azure.mgmt.batchai.models.ContainerSettings
:param tool_type: The toolkit type of this job. Possible values are: cntk,
tensorflow, caffe, caffe2, chainer, pytorch, custom, custommpi, horovod.
Possible values include: 'cntk', 'tensorflow', 'caffe', 'caffe2',
'chainer', 'horovod', 'custommpi', 'custom'
:type tool_type: str or ~azure.mgmt.batchai.models.ToolType
:param cntk_settings: Specifies the settings for CNTK (aka Microsoft
Cognitive Toolkit) job.
:type cntk_settings: ~azure.mgmt.batchai.models.CNTKsettings
:param py_torch_settings: Specifies the settings for pyTorch job.
:type py_torch_settings: ~azure.mgmt.batchai.models.PyTorchSettings
:param tensor_flow_settings: Specifies the settings for Tensor Flow job.
:type tensor_flow_settings: ~azure.mgmt.batchai.models.TensorFlowSettings
:param caffe_settings: Specifies the settings for Caffe job.
:type caffe_settings: ~azure.mgmt.batchai.models.CaffeSettings
:param caffe2_settings: Specifies the settings for Caffe2 job.
:type caffe2_settings: ~azure.mgmt.batchai.models.Caffe2Settings
:param chainer_settings: Specifies the settings for Chainer job.
:type chainer_settings: ~azure.mgmt.batchai.models.ChainerSettings
:param custom_toolkit_settings: Specifies the settings for custom tool kit
job.
:type custom_toolkit_settings:
~azure.mgmt.batchai.models.CustomToolkitSettings
:param custom_mpi_settings: Specifies the settings for custom MPI job.
:type custom_mpi_settings: ~azure.mgmt.batchai.models.CustomMpiSettings
:param horovod_settings: Specifies the settings for Horovod job.
:type horovod_settings: ~azure.mgmt.batchai.models.HorovodSettings
:param job_preparation: Specifies the actions to be performed before tool
kit is launched. The specified actions will run on all the nodes that are
part of the job
:type job_preparation: ~azure.mgmt.batchai.models.JobPreparation
:ivar job_output_directory_path_segment: Output directory path segment. A
segment of job's output directories path created by Batch AI. 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.
:vartype job_output_directory_path_segment: str
:param std_out_err_path_prefix: Standard output directory path prefix. The
path where the Batch AI service stores stdout, stderror and execution log
of the job.
:type std_out_err_path_prefix: str
:param input_directories: Input directories. A list of input directories
for the job.
:type input_directories: list[~azure.mgmt.batchai.models.InputDirectory]
:param output_directories: Output directories. A list of output
directories for the job.
:type output_directories: list[~azure.mgmt.batchai.models.OutputDirectory]
:param environment_variables: Environment variables. A collection of user
defined environment variables to be setup for the job.
:type environment_variables:
list[~azure.mgmt.batchai.models.EnvironmentVariable]
:param secrets: Secrets. A collection of user defined environment
variables with secret values to be setup for the job. Server will never
report values of these variables back.
:type secrets:
list[~azure.mgmt.batchai.models.EnvironmentVariableWithSecretValue]
:param constraints: Constraints associated with the Job.
:type constraints: ~azure.mgmt.batchai.models.JobPropertiesConstraints
:ivar creation_time: Creation time. The creation time of the job.
:vartype creation_time: datetime
:ivar provisioning_state: Provisioning state. The provisioned state of the
Batch AI job. Possible values include: 'creating', 'succeeded', 'failed',
'deleting'
:vartype provisioning_state: str or
~azure.mgmt.batchai.models.ProvisioningState
:ivar provisioning_state_transition_time: Provisioning state transition
time. The time at which the job entered its current provisioning state.
:vartype provisioning_state_transition_time: datetime
:ivar execution_state: Execution state. 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 succesfully 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. Possible values include: 'queued',
'running', 'terminating', 'succeeded', 'failed'
:vartype execution_state: str or ~azure.mgmt.batchai.models.ExecutionState
:ivar execution_state_transition_time: Execution state transition time.
The time at which the job entered its current execution state.
:vartype execution_state_transition_time: datetime
:param execution_info: Information about the execution of a job.
:type execution_info:
~azure.mgmt.batchai.models.JobPropertiesExecutionInfo
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'job_output_directory_path_segment': {'readonly': True},
'creation_time': {'readonly': True},
'provisioning_state': {'readonly': True},
'provisioning_state_transition_time': {'readonly': True},
'execution_state': {'readonly': True},
'execution_state_transition_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'scheduling_priority': {'key': 'properties.schedulingPriority', 'type': 'str'},
'cluster': {'key': 'properties.cluster', 'type': 'ResourceId'},
'mount_volumes': {'key': 'properties.mountVolumes', 'type': 'MountVolumes'},
'node_count': {'key': 'properties.nodeCount', 'type': 'int'},
'container_settings': {'key': 'properties.containerSettings', 'type': 'ContainerSettings'},
'tool_type': {'key': 'properties.toolType', 'type': 'str'},
'cntk_settings': {'key': 'properties.cntkSettings', 'type': 'CNTKsettings'},
'py_torch_settings': {'key': 'properties.pyTorchSettings', 'type': 'PyTorchSettings'},
'tensor_flow_settings': {'key': 'properties.tensorFlowSettings', 'type': 'TensorFlowSettings'},
'caffe_settings': {'key': 'properties.caffeSettings', 'type': 'CaffeSettings'},
'caffe2_settings': {'key': 'properties.caffe2Settings', 'type': 'Caffe2Settings'},
'chainer_settings': {'key': 'properties.chainerSettings', 'type': 'ChainerSettings'},
'custom_toolkit_settings': {'key': 'properties.customToolkitSettings', 'type': 'CustomToolkitSettings'},
'custom_mpi_settings': {'key': 'properties.customMpiSettings', 'type': 'CustomMpiSettings'},
'horovod_settings': {'key': 'properties.horovodSettings', 'type': 'HorovodSettings'},
'job_preparation': {'key': 'properties.jobPreparation', 'type': 'JobPreparation'},
'job_output_directory_path_segment': {'key': 'properties.jobOutputDirectoryPathSegment', 'type': 'str'},
'std_out_err_path_prefix': {'key': 'properties.stdOutErrPathPrefix', 'type': 'str'},
'input_directories': {'key': 'properties.inputDirectories', 'type': '[InputDirectory]'},
'output_directories': {'key': 'properties.outputDirectories', 'type': '[OutputDirectory]'},
'environment_variables': {'key': 'properties.environmentVariables', 'type': '[EnvironmentVariable]'},
'secrets': {'key': 'properties.secrets', 'type': '[EnvironmentVariableWithSecretValue]'},
'constraints': {'key': 'properties.constraints', 'type': 'JobPropertiesConstraints'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'provisioning_state_transition_time': {'key': 'properties.provisioningStateTransitionTime', 'type': 'iso-8601'},
'execution_state': {'key': 'properties.executionState', 'type': 'str'},
'execution_state_transition_time': {'key': 'properties.executionStateTransitionTime', 'type': 'iso-8601'},
'execution_info': {'key': 'properties.executionInfo', 'type': 'JobPropertiesExecutionInfo'},
}
def __init__(self, **kwargs):
super(Job, self).__init__(**kwargs)
self.scheduling_priority = kwargs.get('scheduling_priority', "normal")
self.cluster = kwargs.get('cluster', None)
self.mount_volumes = kwargs.get('mount_volumes', None)
self.node_count = kwargs.get('node_count', None)
self.container_settings = kwargs.get('container_settings', None)
self.tool_type = kwargs.get('tool_type', None)
self.cntk_settings = kwargs.get('cntk_settings', None)
self.py_torch_settings = kwargs.get('py_torch_settings', None)
self.tensor_flow_settings = kwargs.get('tensor_flow_settings', None)
self.caffe_settings = kwargs.get('caffe_settings', None)
self.caffe2_settings = kwargs.get('caffe2_settings', None)
self.chainer_settings = kwargs.get('chainer_settings', None)
self.custom_toolkit_settings = kwargs.get('custom_toolkit_settings', None)
self.custom_mpi_settings = kwargs.get('custom_mpi_settings', None)
self.horovod_settings = kwargs.get('horovod_settings', None)
self.job_preparation = kwargs.get('job_preparation', None)
self.job_output_directory_path_segment = None
self.std_out_err_path_prefix = kwargs.get('std_out_err_path_prefix', None)
self.input_directories = kwargs.get('input_directories', None)
self.output_directories = kwargs.get('output_directories', None)
self.environment_variables = kwargs.get('environment_variables', None)
self.secrets = kwargs.get('secrets', None)
self.constraints = kwargs.get('constraints', None)
self.creation_time = None
self.provisioning_state = None
self.provisioning_state_transition_time = None
self.execution_state = None
self.execution_state_transition_time = None
self.execution_info = kwargs.get('execution_info', None)