tencentcloud-sdk-batch 1.0.200

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,796 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Batch
21
+ module V20170312
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2017-03-12'
26
+ api_endpoint = 'batch.tencentcloudapi.com'
27
+ sdk_version = 'BATCH_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 此接口可将已存在实例添加到计算环境中。
33
+ # 实例需要满足如下条件:<br/>
34
+ # 1.实例不在批量计算系统中。<br/>
35
+ # 2.实例状态要求处于运行中。<br/>
36
+ # 3.支持预付费实例,按小时后付费实例,专享子机实例。不支持竞价实例。<br/>
37
+
38
+ # 此接口会将加入到计算环境中的实例重设UserData和重装操作系统。
39
+
40
+ # @param request: Request instance for AttachInstances.
41
+ # @type request: :class:`Tencentcloud::batch::V20170312::AttachInstancesRequest`
42
+ # @rtype: :class:`Tencentcloud::batch::V20170312::AttachInstancesResponse`
43
+ def AttachInstances(request)
44
+ body = send_request('AttachInstances', request.serialize)
45
+ response = JSON.parse(body)
46
+ if response['Response'].key?('Error') == false
47
+ model = AttachInstancesResponse.new
48
+ model.deserialize(response['Response'])
49
+ model
50
+ else
51
+ code = response['Response']['Error']['Code']
52
+ message = response['Response']['Error']['Message']
53
+ reqid = response['Response']['RequestId']
54
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
55
+ end
56
+ rescue TencentCloud::Common::TencentCloudSDKException => e
57
+ raise e
58
+ rescue StandardError => e
59
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
60
+ end
61
+
62
+ # 用于创建计算环境
63
+
64
+ # @param request: Request instance for CreateComputeEnv.
65
+ # @type request: :class:`Tencentcloud::batch::V20170312::CreateComputeEnvRequest`
66
+ # @rtype: :class:`Tencentcloud::batch::V20170312::CreateComputeEnvResponse`
67
+ def CreateComputeEnv(request)
68
+ body = send_request('CreateComputeEnv', request.serialize)
69
+ response = JSON.parse(body)
70
+ if response['Response'].key?('Error') == false
71
+ model = CreateComputeEnvResponse.new
72
+ model.deserialize(response['Response'])
73
+ model
74
+ else
75
+ code = response['Response']['Error']['Code']
76
+ message = response['Response']['Error']['Message']
77
+ reqid = response['Response']['RequestId']
78
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
79
+ end
80
+ rescue TencentCloud::Common::TencentCloudSDKException => e
81
+ raise e
82
+ rescue StandardError => e
83
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
84
+ end
85
+
86
+ # 创建黑石计算环境
87
+
88
+ # @param request: Request instance for CreateCpmComputeEnv.
89
+ # @type request: :class:`Tencentcloud::batch::V20170312::CreateCpmComputeEnvRequest`
90
+ # @rtype: :class:`Tencentcloud::batch::V20170312::CreateCpmComputeEnvResponse`
91
+ def CreateCpmComputeEnv(request)
92
+ body = send_request('CreateCpmComputeEnv', request.serialize)
93
+ response = JSON.parse(body)
94
+ if response['Response'].key?('Error') == false
95
+ model = CreateCpmComputeEnvResponse.new
96
+ model.deserialize(response['Response'])
97
+ model
98
+ else
99
+ code = response['Response']['Error']['Code']
100
+ message = response['Response']['Error']['Message']
101
+ reqid = response['Response']['RequestId']
102
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
103
+ end
104
+ rescue TencentCloud::Common::TencentCloudSDKException => e
105
+ raise e
106
+ rescue StandardError => e
107
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
108
+ end
109
+
110
+ # 用于创建任务模板
111
+
112
+ # @param request: Request instance for CreateTaskTemplate.
113
+ # @type request: :class:`Tencentcloud::batch::V20170312::CreateTaskTemplateRequest`
114
+ # @rtype: :class:`Tencentcloud::batch::V20170312::CreateTaskTemplateResponse`
115
+ def CreateTaskTemplate(request)
116
+ body = send_request('CreateTaskTemplate', request.serialize)
117
+ response = JSON.parse(body)
118
+ if response['Response'].key?('Error') == false
119
+ model = CreateTaskTemplateResponse.new
120
+ model.deserialize(response['Response'])
121
+ model
122
+ else
123
+ code = response['Response']['Error']['Code']
124
+ message = response['Response']['Error']['Message']
125
+ reqid = response['Response']['RequestId']
126
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
127
+ end
128
+ rescue TencentCloud::Common::TencentCloudSDKException => e
129
+ raise e
130
+ rescue StandardError => e
131
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
132
+ end
133
+
134
+ # 用于删除计算环境
135
+
136
+ # @param request: Request instance for DeleteComputeEnv.
137
+ # @type request: :class:`Tencentcloud::batch::V20170312::DeleteComputeEnvRequest`
138
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DeleteComputeEnvResponse`
139
+ def DeleteComputeEnv(request)
140
+ body = send_request('DeleteComputeEnv', request.serialize)
141
+ response = JSON.parse(body)
142
+ if response['Response'].key?('Error') == false
143
+ model = DeleteComputeEnvResponse.new
144
+ model.deserialize(response['Response'])
145
+ model
146
+ else
147
+ code = response['Response']['Error']['Code']
148
+ message = response['Response']['Error']['Message']
149
+ reqid = response['Response']['RequestId']
150
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
151
+ end
152
+ rescue TencentCloud::Common::TencentCloudSDKException => e
153
+ raise e
154
+ rescue StandardError => e
155
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
156
+ end
157
+
158
+ # 用于删除作业记录。
159
+ # 删除作业的效果相当于删除作业相关的所有信息。删除成功后,作业相关的所有信息都无法查询。
160
+ # 待删除的作业必须处于完结状态,且其内部包含的所有任务实例也必须处于完结状态,否则会禁止操作。完结状态,是指处于 SUCCEED 或 FAILED 状态。
161
+
162
+ # @param request: Request instance for DeleteJob.
163
+ # @type request: :class:`Tencentcloud::batch::V20170312::DeleteJobRequest`
164
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DeleteJobResponse`
165
+ def DeleteJob(request)
166
+ body = send_request('DeleteJob', request.serialize)
167
+ response = JSON.parse(body)
168
+ if response['Response'].key?('Error') == false
169
+ model = DeleteJobResponse.new
170
+ model.deserialize(response['Response'])
171
+ model
172
+ else
173
+ code = response['Response']['Error']['Code']
174
+ message = response['Response']['Error']['Message']
175
+ reqid = response['Response']['RequestId']
176
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
177
+ end
178
+ rescue TencentCloud::Common::TencentCloudSDKException => e
179
+ raise e
180
+ rescue StandardError => e
181
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
182
+ end
183
+
184
+ # 用于删除任务模板信息
185
+
186
+ # @param request: Request instance for DeleteTaskTemplates.
187
+ # @type request: :class:`Tencentcloud::batch::V20170312::DeleteTaskTemplatesRequest`
188
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DeleteTaskTemplatesResponse`
189
+ def DeleteTaskTemplates(request)
190
+ body = send_request('DeleteTaskTemplates', request.serialize)
191
+ response = JSON.parse(body)
192
+ if response['Response'].key?('Error') == false
193
+ model = DeleteTaskTemplatesResponse.new
194
+ model.deserialize(response['Response'])
195
+ model
196
+ else
197
+ code = response['Response']['Error']['Code']
198
+ message = response['Response']['Error']['Message']
199
+ reqid = response['Response']['RequestId']
200
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
201
+ end
202
+ rescue TencentCloud::Common::TencentCloudSDKException => e
203
+ raise e
204
+ rescue StandardError => e
205
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
206
+ end
207
+
208
+ # 查看可用的CVM机型配置信息
209
+
210
+ # @param request: Request instance for DescribeAvailableCvmInstanceTypes.
211
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeAvailableCvmInstanceTypesRequest`
212
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeAvailableCvmInstanceTypesResponse`
213
+ def DescribeAvailableCvmInstanceTypes(request)
214
+ body = send_request('DescribeAvailableCvmInstanceTypes', request.serialize)
215
+ response = JSON.parse(body)
216
+ if response['Response'].key?('Error') == false
217
+ model = DescribeAvailableCvmInstanceTypesResponse.new
218
+ model.deserialize(response['Response'])
219
+ model
220
+ else
221
+ code = response['Response']['Error']['Code']
222
+ message = response['Response']['Error']['Message']
223
+ reqid = response['Response']['RequestId']
224
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
225
+ end
226
+ rescue TencentCloud::Common::TencentCloudSDKException => e
227
+ raise e
228
+ rescue StandardError => e
229
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
230
+ end
231
+
232
+ # 用于查询计算环境的详细信息
233
+
234
+ # @param request: Request instance for DescribeComputeEnv.
235
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvRequest`
236
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvResponse`
237
+ def DescribeComputeEnv(request)
238
+ body = send_request('DescribeComputeEnv', request.serialize)
239
+ response = JSON.parse(body)
240
+ if response['Response'].key?('Error') == false
241
+ model = DescribeComputeEnvResponse.new
242
+ model.deserialize(response['Response'])
243
+ model
244
+ else
245
+ code = response['Response']['Error']['Code']
246
+ message = response['Response']['Error']['Message']
247
+ reqid = response['Response']['RequestId']
248
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
249
+ end
250
+ rescue TencentCloud::Common::TencentCloudSDKException => e
251
+ raise e
252
+ rescue StandardError => e
253
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
254
+ end
255
+
256
+ # 用于查询计算环境的活动信息
257
+
258
+ # @param request: Request instance for DescribeComputeEnvActivities.
259
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvActivitiesRequest`
260
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvActivitiesResponse`
261
+ def DescribeComputeEnvActivities(request)
262
+ body = send_request('DescribeComputeEnvActivities', request.serialize)
263
+ response = JSON.parse(body)
264
+ if response['Response'].key?('Error') == false
265
+ model = DescribeComputeEnvActivitiesResponse.new
266
+ model.deserialize(response['Response'])
267
+ model
268
+ else
269
+ code = response['Response']['Error']['Code']
270
+ message = response['Response']['Error']['Message']
271
+ reqid = response['Response']['RequestId']
272
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
273
+ end
274
+ rescue TencentCloud::Common::TencentCloudSDKException => e
275
+ raise e
276
+ rescue StandardError => e
277
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
278
+ end
279
+
280
+ # 查看计算环境的创建信息。
281
+
282
+ # @param request: Request instance for DescribeComputeEnvCreateInfo.
283
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvCreateInfoRequest`
284
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvCreateInfoResponse`
285
+ def DescribeComputeEnvCreateInfo(request)
286
+ body = send_request('DescribeComputeEnvCreateInfo', request.serialize)
287
+ response = JSON.parse(body)
288
+ if response['Response'].key?('Error') == false
289
+ model = DescribeComputeEnvCreateInfoResponse.new
290
+ model.deserialize(response['Response'])
291
+ model
292
+ else
293
+ code = response['Response']['Error']['Code']
294
+ message = response['Response']['Error']['Message']
295
+ reqid = response['Response']['RequestId']
296
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
297
+ end
298
+ rescue TencentCloud::Common::TencentCloudSDKException => e
299
+ raise e
300
+ rescue StandardError => e
301
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
302
+ end
303
+
304
+ # 用于查看计算环境创建信息列表,包括名称、描述、类型、环境参数、通知及期望节点数等。
305
+
306
+ # @param request: Request instance for DescribeComputeEnvCreateInfos.
307
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvCreateInfosRequest`
308
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvCreateInfosResponse`
309
+ def DescribeComputeEnvCreateInfos(request)
310
+ body = send_request('DescribeComputeEnvCreateInfos', request.serialize)
311
+ response = JSON.parse(body)
312
+ if response['Response'].key?('Error') == false
313
+ model = DescribeComputeEnvCreateInfosResponse.new
314
+ model.deserialize(response['Response'])
315
+ model
316
+ else
317
+ code = response['Response']['Error']['Code']
318
+ message = response['Response']['Error']['Message']
319
+ reqid = response['Response']['RequestId']
320
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
321
+ end
322
+ rescue TencentCloud::Common::TencentCloudSDKException => e
323
+ raise e
324
+ rescue StandardError => e
325
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
326
+ end
327
+
328
+ # 用于查看计算环境列表
329
+
330
+ # @param request: Request instance for DescribeComputeEnvs.
331
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvsRequest`
332
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeComputeEnvsResponse`
333
+ def DescribeComputeEnvs(request)
334
+ body = send_request('DescribeComputeEnvs', request.serialize)
335
+ response = JSON.parse(body)
336
+ if response['Response'].key?('Error') == false
337
+ model = DescribeComputeEnvsResponse.new
338
+ model.deserialize(response['Response'])
339
+ model
340
+ else
341
+ code = response['Response']['Error']['Code']
342
+ message = response['Response']['Error']['Message']
343
+ reqid = response['Response']['RequestId']
344
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
345
+ end
346
+ rescue TencentCloud::Common::TencentCloudSDKException => e
347
+ raise e
348
+ rescue StandardError => e
349
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
350
+ end
351
+
352
+ # 创建黑石计算环境时,查询批量计算环境支持的黑石操作系统信息
353
+
354
+ # @param request: Request instance for DescribeCpmOsInfo.
355
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeCpmOsInfoRequest`
356
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeCpmOsInfoResponse`
357
+ def DescribeCpmOsInfo(request)
358
+ body = send_request('DescribeCpmOsInfo', request.serialize)
359
+ response = JSON.parse(body)
360
+ if response['Response'].key?('Error') == false
361
+ model = DescribeCpmOsInfoResponse.new
362
+ model.deserialize(response['Response'])
363
+ model
364
+ else
365
+ code = response['Response']['Error']['Code']
366
+ message = response['Response']['Error']['Message']
367
+ reqid = response['Response']['RequestId']
368
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
369
+ end
370
+ rescue TencentCloud::Common::TencentCloudSDKException => e
371
+ raise e
372
+ rescue StandardError => e
373
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
374
+ end
375
+
376
+ # 获取批量计算可用区机型配置信息
377
+
378
+ # @param request: Request instance for DescribeCvmZoneInstanceConfigInfos.
379
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeCvmZoneInstanceConfigInfosRequest`
380
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeCvmZoneInstanceConfigInfosResponse`
381
+ def DescribeCvmZoneInstanceConfigInfos(request)
382
+ body = send_request('DescribeCvmZoneInstanceConfigInfos', request.serialize)
383
+ response = JSON.parse(body)
384
+ if response['Response'].key?('Error') == false
385
+ model = DescribeCvmZoneInstanceConfigInfosResponse.new
386
+ model.deserialize(response['Response'])
387
+ model
388
+ else
389
+ code = response['Response']['Error']['Code']
390
+ message = response['Response']['Error']['Message']
391
+ reqid = response['Response']['RequestId']
392
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
393
+ end
394
+ rescue TencentCloud::Common::TencentCloudSDKException => e
395
+ raise e
396
+ rescue StandardError => e
397
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
398
+ end
399
+
400
+ # 目前对CVM现有实例族分类,每一类包含若干实例族。该接口用于查询实例分类信息。
401
+
402
+ # @param request: Request instance for DescribeInstanceCategories.
403
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeInstanceCategoriesRequest`
404
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeInstanceCategoriesResponse`
405
+ def DescribeInstanceCategories(request)
406
+ body = send_request('DescribeInstanceCategories', request.serialize)
407
+ response = JSON.parse(body)
408
+ if response['Response'].key?('Error') == false
409
+ model = DescribeInstanceCategoriesResponse.new
410
+ model.deserialize(response['Response'])
411
+ model
412
+ else
413
+ code = response['Response']['Error']['Code']
414
+ message = response['Response']['Error']['Message']
415
+ reqid = response['Response']['RequestId']
416
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
417
+ end
418
+ rescue TencentCloud::Common::TencentCloudSDKException => e
419
+ raise e
420
+ rescue StandardError => e
421
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
422
+ end
423
+
424
+ # 用于查看一个作业的详细信息,包括内部任务(Task)和依赖(Dependence)信息。
425
+
426
+ # @param request: Request instance for DescribeJob.
427
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeJobRequest`
428
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeJobResponse`
429
+ def DescribeJob(request)
430
+ body = send_request('DescribeJob', request.serialize)
431
+ response = JSON.parse(body)
432
+ if response['Response'].key?('Error') == false
433
+ model = DescribeJobResponse.new
434
+ model.deserialize(response['Response'])
435
+ model
436
+ else
437
+ code = response['Response']['Error']['Code']
438
+ message = response['Response']['Error']['Message']
439
+ reqid = response['Response']['RequestId']
440
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
441
+ end
442
+ rescue TencentCloud::Common::TencentCloudSDKException => e
443
+ raise e
444
+ rescue StandardError => e
445
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
446
+ end
447
+
448
+ # 用于查询指定作业的提交信息,其返回内容包括 JobId 和 SubmitJob 接口中作为输入参数的作业提交信息
449
+
450
+ # @param request: Request instance for DescribeJobSubmitInfo.
451
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeJobSubmitInfoRequest`
452
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeJobSubmitInfoResponse`
453
+ def DescribeJobSubmitInfo(request)
454
+ body = send_request('DescribeJobSubmitInfo', request.serialize)
455
+ response = JSON.parse(body)
456
+ if response['Response'].key?('Error') == false
457
+ model = DescribeJobSubmitInfoResponse.new
458
+ model.deserialize(response['Response'])
459
+ model
460
+ else
461
+ code = response['Response']['Error']['Code']
462
+ message = response['Response']['Error']['Message']
463
+ reqid = response['Response']['RequestId']
464
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
465
+ end
466
+ rescue TencentCloud::Common::TencentCloudSDKException => e
467
+ raise e
468
+ rescue StandardError => e
469
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
470
+ end
471
+
472
+ # 用于查询若干个作业的概览信息
473
+
474
+ # @param request: Request instance for DescribeJobs.
475
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeJobsRequest`
476
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeJobsResponse`
477
+ def DescribeJobs(request)
478
+ body = send_request('DescribeJobs', request.serialize)
479
+ response = JSON.parse(body)
480
+ if response['Response'].key?('Error') == false
481
+ model = DescribeJobsResponse.new
482
+ model.deserialize(response['Response'])
483
+ model
484
+ else
485
+ code = response['Response']['Error']['Code']
486
+ message = response['Response']['Error']['Message']
487
+ reqid = response['Response']['RequestId']
488
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
489
+ end
490
+ rescue TencentCloud::Common::TencentCloudSDKException => e
491
+ raise e
492
+ rescue StandardError => e
493
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
494
+ end
495
+
496
+ # 用于查询指定任务的详细信息,包括任务内部的任务实例信息。
497
+
498
+ # @param request: Request instance for DescribeTask.
499
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeTaskRequest`
500
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeTaskResponse`
501
+ def DescribeTask(request)
502
+ body = send_request('DescribeTask', request.serialize)
503
+ response = JSON.parse(body)
504
+ if response['Response'].key?('Error') == false
505
+ model = DescribeTaskResponse.new
506
+ model.deserialize(response['Response'])
507
+ model
508
+ else
509
+ code = response['Response']['Error']['Code']
510
+ message = response['Response']['Error']['Message']
511
+ reqid = response['Response']['RequestId']
512
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
513
+ end
514
+ rescue TencentCloud::Common::TencentCloudSDKException => e
515
+ raise e
516
+ rescue StandardError => e
517
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
518
+ end
519
+
520
+ # 用于获取任务多个实例标准输出和标准错误日志。
521
+
522
+ # @param request: Request instance for DescribeTaskLogs.
523
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeTaskLogsRequest`
524
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeTaskLogsResponse`
525
+ def DescribeTaskLogs(request)
526
+ body = send_request('DescribeTaskLogs', request.serialize)
527
+ response = JSON.parse(body)
528
+ if response['Response'].key?('Error') == false
529
+ model = DescribeTaskLogsResponse.new
530
+ model.deserialize(response['Response'])
531
+ model
532
+ else
533
+ code = response['Response']['Error']['Code']
534
+ message = response['Response']['Error']['Message']
535
+ reqid = response['Response']['RequestId']
536
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
537
+ end
538
+ rescue TencentCloud::Common::TencentCloudSDKException => e
539
+ raise e
540
+ rescue StandardError => e
541
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
542
+ end
543
+
544
+ # 用于查询任务模板信息
545
+
546
+ # @param request: Request instance for DescribeTaskTemplates.
547
+ # @type request: :class:`Tencentcloud::batch::V20170312::DescribeTaskTemplatesRequest`
548
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DescribeTaskTemplatesResponse`
549
+ def DescribeTaskTemplates(request)
550
+ body = send_request('DescribeTaskTemplates', request.serialize)
551
+ response = JSON.parse(body)
552
+ if response['Response'].key?('Error') == false
553
+ model = DescribeTaskTemplatesResponse.new
554
+ model.deserialize(response['Response'])
555
+ model
556
+ else
557
+ code = response['Response']['Error']['Code']
558
+ message = response['Response']['Error']['Message']
559
+ reqid = response['Response']['RequestId']
560
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
561
+ end
562
+ rescue TencentCloud::Common::TencentCloudSDKException => e
563
+ raise e
564
+ rescue StandardError => e
565
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
566
+ end
567
+
568
+ # 将添加到计算环境中的实例从计算环境中移出。若是由批量计算自动创建的计算节点实例则不允许移出。
569
+
570
+ # @param request: Request instance for DetachInstances.
571
+ # @type request: :class:`Tencentcloud::batch::V20170312::DetachInstancesRequest`
572
+ # @rtype: :class:`Tencentcloud::batch::V20170312::DetachInstancesResponse`
573
+ def DetachInstances(request)
574
+ body = send_request('DetachInstances', request.serialize)
575
+ response = JSON.parse(body)
576
+ if response['Response'].key?('Error') == false
577
+ model = DetachInstancesResponse.new
578
+ model.deserialize(response['Response'])
579
+ model
580
+ else
581
+ code = response['Response']['Error']['Code']
582
+ message = response['Response']['Error']['Message']
583
+ reqid = response['Response']['RequestId']
584
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
585
+ end
586
+ rescue TencentCloud::Common::TencentCloudSDKException => e
587
+ raise e
588
+ rescue StandardError => e
589
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
590
+ end
591
+
592
+ # 用于修改计算环境属性
593
+
594
+ # @param request: Request instance for ModifyComputeEnv.
595
+ # @type request: :class:`Tencentcloud::batch::V20170312::ModifyComputeEnvRequest`
596
+ # @rtype: :class:`Tencentcloud::batch::V20170312::ModifyComputeEnvResponse`
597
+ def ModifyComputeEnv(request)
598
+ body = send_request('ModifyComputeEnv', request.serialize)
599
+ response = JSON.parse(body)
600
+ if response['Response'].key?('Error') == false
601
+ model = ModifyComputeEnvResponse.new
602
+ model.deserialize(response['Response'])
603
+ model
604
+ else
605
+ code = response['Response']['Error']['Code']
606
+ message = response['Response']['Error']['Message']
607
+ reqid = response['Response']['RequestId']
608
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
609
+ end
610
+ rescue TencentCloud::Common::TencentCloudSDKException => e
611
+ raise e
612
+ rescue StandardError => e
613
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
614
+ end
615
+
616
+ # 用于修改任务模板
617
+
618
+ # @param request: Request instance for ModifyTaskTemplate.
619
+ # @type request: :class:`Tencentcloud::batch::V20170312::ModifyTaskTemplateRequest`
620
+ # @rtype: :class:`Tencentcloud::batch::V20170312::ModifyTaskTemplateResponse`
621
+ def ModifyTaskTemplate(request)
622
+ body = send_request('ModifyTaskTemplate', request.serialize)
623
+ response = JSON.parse(body)
624
+ if response['Response'].key?('Error') == false
625
+ model = ModifyTaskTemplateResponse.new
626
+ model.deserialize(response['Response'])
627
+ model
628
+ else
629
+ code = response['Response']['Error']['Code']
630
+ message = response['Response']['Error']['Message']
631
+ reqid = response['Response']['RequestId']
632
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
633
+ end
634
+ rescue TencentCloud::Common::TencentCloudSDKException => e
635
+ raise e
636
+ rescue StandardError => e
637
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
638
+ end
639
+
640
+ # 用于重试作业中失败的任务实例。
641
+ # 当且仅当作业处于“FAILED”状态,支持重试操作。重试操作成功后,作业会按照“DAG”中指定的任务依赖关系,依次重试各个任务中失败的任务实例。任务实例的历史信息将被重置,如同首次运行一样,参与后续的调度和执行。
642
+
643
+ # @param request: Request instance for RetryJobs.
644
+ # @type request: :class:`Tencentcloud::batch::V20170312::RetryJobsRequest`
645
+ # @rtype: :class:`Tencentcloud::batch::V20170312::RetryJobsResponse`
646
+ def RetryJobs(request)
647
+ body = send_request('RetryJobs', request.serialize)
648
+ response = JSON.parse(body)
649
+ if response['Response'].key?('Error') == false
650
+ model = RetryJobsResponse.new
651
+ model.deserialize(response['Response'])
652
+ model
653
+ else
654
+ code = response['Response']['Error']['Code']
655
+ message = response['Response']['Error']['Message']
656
+ reqid = response['Response']['RequestId']
657
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
658
+ end
659
+ rescue TencentCloud::Common::TencentCloudSDKException => e
660
+ raise e
661
+ rescue StandardError => e
662
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
663
+ end
664
+
665
+ # 用于提交一个作业
666
+
667
+ # @param request: Request instance for SubmitJob.
668
+ # @type request: :class:`Tencentcloud::batch::V20170312::SubmitJobRequest`
669
+ # @rtype: :class:`Tencentcloud::batch::V20170312::SubmitJobResponse`
670
+ def SubmitJob(request)
671
+ body = send_request('SubmitJob', request.serialize)
672
+ response = JSON.parse(body)
673
+ if response['Response'].key?('Error') == false
674
+ model = SubmitJobResponse.new
675
+ model.deserialize(response['Response'])
676
+ model
677
+ else
678
+ code = response['Response']['Error']['Code']
679
+ message = response['Response']['Error']['Message']
680
+ reqid = response['Response']['RequestId']
681
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
682
+ end
683
+ rescue TencentCloud::Common::TencentCloudSDKException => e
684
+ raise e
685
+ rescue StandardError => e
686
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
687
+ end
688
+
689
+ # 用于销毁计算节点。
690
+ # 对于状态为CREATED、CREATION_FAILED、RUNNING和ABNORMAL的节点,允许销毁处理。
691
+
692
+ # @param request: Request instance for TerminateComputeNode.
693
+ # @type request: :class:`Tencentcloud::batch::V20170312::TerminateComputeNodeRequest`
694
+ # @rtype: :class:`Tencentcloud::batch::V20170312::TerminateComputeNodeResponse`
695
+ def TerminateComputeNode(request)
696
+ body = send_request('TerminateComputeNode', request.serialize)
697
+ response = JSON.parse(body)
698
+ if response['Response'].key?('Error') == false
699
+ model = TerminateComputeNodeResponse.new
700
+ model.deserialize(response['Response'])
701
+ model
702
+ else
703
+ code = response['Response']['Error']['Code']
704
+ message = response['Response']['Error']['Message']
705
+ reqid = response['Response']['RequestId']
706
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
707
+ end
708
+ rescue TencentCloud::Common::TencentCloudSDKException => e
709
+ raise e
710
+ rescue StandardError => e
711
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
712
+ end
713
+
714
+ # 用于批量销毁计算节点,不允许重复销毁同一个节点。
715
+
716
+ # @param request: Request instance for TerminateComputeNodes.
717
+ # @type request: :class:`Tencentcloud::batch::V20170312::TerminateComputeNodesRequest`
718
+ # @rtype: :class:`Tencentcloud::batch::V20170312::TerminateComputeNodesResponse`
719
+ def TerminateComputeNodes(request)
720
+ body = send_request('TerminateComputeNodes', request.serialize)
721
+ response = JSON.parse(body)
722
+ if response['Response'].key?('Error') == false
723
+ model = TerminateComputeNodesResponse.new
724
+ model.deserialize(response['Response'])
725
+ model
726
+ else
727
+ code = response['Response']['Error']['Code']
728
+ message = response['Response']['Error']['Message']
729
+ reqid = response['Response']['RequestId']
730
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
731
+ end
732
+ rescue TencentCloud::Common::TencentCloudSDKException => e
733
+ raise e
734
+ rescue StandardError => e
735
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
736
+ end
737
+
738
+ # 用于终止作业。
739
+ # 当作业处于“SUBMITTED”状态时,禁止终止操作;当作业处于“SUCCEED”状态时,终止操作不会生效。
740
+ # 终止作业是一个异步过程。整个终止过程的耗时和任务总数成正比。终止的效果相当于所含的所有任务实例进行TerminateTaskInstance操作。具体效果和用法可参考TerminateTaskInstance。
741
+
742
+ # @param request: Request instance for TerminateJob.
743
+ # @type request: :class:`Tencentcloud::batch::V20170312::TerminateJobRequest`
744
+ # @rtype: :class:`Tencentcloud::batch::V20170312::TerminateJobResponse`
745
+ def TerminateJob(request)
746
+ body = send_request('TerminateJob', request.serialize)
747
+ response = JSON.parse(body)
748
+ if response['Response'].key?('Error') == false
749
+ model = TerminateJobResponse.new
750
+ model.deserialize(response['Response'])
751
+ model
752
+ else
753
+ code = response['Response']['Error']['Code']
754
+ message = response['Response']['Error']['Message']
755
+ reqid = response['Response']['RequestId']
756
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
757
+ end
758
+ rescue TencentCloud::Common::TencentCloudSDKException => e
759
+ raise e
760
+ rescue StandardError => e
761
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
762
+ end
763
+
764
+ # 用于终止任务实例。
765
+ # 对于状态已经为“SUCCEED”和“FAILED”的任务实例,不做处理。
766
+ # 对于状态为“SUBMITTED”、“PENDING”、“RUNNABLE”的任务实例,状态将置为“FAILED”状态。
767
+ # 对于状态为“STARTING”、“RUNNING”、“FAILED_INTERRUPTED”的任务实例,分区两种情况:如果未显示指定计算环境,会先销毁CVM服务器,然后将状态置为“FAILED”,具有一定耗时;如果指定了计算环境EnvId,任务实例状态置为“FAILED”,并重启执行该任务的CVM服务器,具有一定的耗时。
768
+ # 对于状态为“FAILED_INTERRUPTED”的任务实例,终止操作实际成功之后,相关资源和配额才会释放。
769
+
770
+ # @param request: Request instance for TerminateTaskInstance.
771
+ # @type request: :class:`Tencentcloud::batch::V20170312::TerminateTaskInstanceRequest`
772
+ # @rtype: :class:`Tencentcloud::batch::V20170312::TerminateTaskInstanceResponse`
773
+ def TerminateTaskInstance(request)
774
+ body = send_request('TerminateTaskInstance', request.serialize)
775
+ response = JSON.parse(body)
776
+ if response['Response'].key?('Error') == false
777
+ model = TerminateTaskInstanceResponse.new
778
+ model.deserialize(response['Response'])
779
+ model
780
+ else
781
+ code = response['Response']['Error']['Code']
782
+ message = response['Response']['Error']['Message']
783
+ reqid = response['Response']['RequestId']
784
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
785
+ end
786
+ rescue TencentCloud::Common::TencentCloudSDKException => e
787
+ raise e
788
+ rescue StandardError => e
789
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
790
+ end
791
+
792
+
793
+ end
794
+ end
795
+ end
796
+ end