第一次提交:阿龙电竞 Django 后端最新版本
This commit is contained in:
@@ -0,0 +1,732 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. 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.
|
||||
|
||||
import json
|
||||
|
||||
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
|
||||
from tencentcloud.common.abstract_client import AbstractClient
|
||||
from tencentcloud.batch.v20170312 import models
|
||||
|
||||
|
||||
class BatchClient(AbstractClient):
|
||||
_apiVersion = '2017-03-12'
|
||||
_endpoint = 'batch.tencentcloudapi.com'
|
||||
_service = 'batch'
|
||||
|
||||
|
||||
def AttachInstances(self, request):
|
||||
r"""此接口可将已存在实例添加到计算环境中。
|
||||
实例需要满足如下条件:<br/>
|
||||
1.实例不在批量计算系统中。<br/>
|
||||
2.实例状态要求处于运行中。<br/>
|
||||
3.支持预付费实例,按小时后付费实例,专享子机实例。不支持竞价实例。<br/>
|
||||
|
||||
此接口会将加入到计算环境中的实例重设UserData和重装操作系统。
|
||||
|
||||
:param request: Request instance for AttachInstances.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.AttachInstancesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.AttachInstancesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("AttachInstances", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.AttachInstancesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def CreateComputeEnv(self, request):
|
||||
r"""用于创建计算环境
|
||||
|
||||
:param request: Request instance for CreateComputeEnv.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.CreateComputeEnvRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.CreateComputeEnvResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateComputeEnv", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateComputeEnvResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def CreateTaskTemplate(self, request):
|
||||
r"""用于创建任务模板
|
||||
|
||||
:param request: Request instance for CreateTaskTemplate.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.CreateTaskTemplateRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.CreateTaskTemplateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("CreateTaskTemplate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.CreateTaskTemplateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DeleteComputeEnv(self, request):
|
||||
r"""用于删除计算环境
|
||||
|
||||
:param request: Request instance for DeleteComputeEnv.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DeleteComputeEnvRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DeleteComputeEnvResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DeleteComputeEnv", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DeleteComputeEnvResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DeleteJob(self, request):
|
||||
r"""用于删除作业记录。
|
||||
删除作业的效果相当于删除作业相关的所有信息。删除成功后,作业相关的所有信息都无法查询。
|
||||
待删除的作业必须处于完结状态,且其内部包含的所有任务实例也必须处于完结状态,否则会禁止操作。完结状态,是指处于 SUCCEED 或 FAILED 状态。
|
||||
|
||||
:param request: Request instance for DeleteJob.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DeleteJobRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DeleteJobResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DeleteJob", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DeleteJobResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DeleteTaskTemplates(self, request):
|
||||
r"""用于删除任务模板信息
|
||||
|
||||
:param request: Request instance for DeleteTaskTemplates.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DeleteTaskTemplatesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DeleteTaskTemplatesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DeleteTaskTemplates", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DeleteTaskTemplatesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeAvailableCvmInstanceTypes(self, request):
|
||||
r"""查看可用的CVM机型配置信息
|
||||
|
||||
:param request: Request instance for DescribeAvailableCvmInstanceTypes.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeAvailableCvmInstanceTypesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeAvailableCvmInstanceTypesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeAvailableCvmInstanceTypes", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeAvailableCvmInstanceTypesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeComputeEnv(self, request):
|
||||
r"""用于查询计算环境的详细信息
|
||||
|
||||
:param request: Request instance for DescribeComputeEnv.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeComputeEnv", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeComputeEnvResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeComputeEnvActivities(self, request):
|
||||
r"""用于查询计算环境的活动信息
|
||||
|
||||
:param request: Request instance for DescribeComputeEnvActivities.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvActivitiesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvActivitiesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeComputeEnvActivities", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeComputeEnvActivitiesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeComputeEnvCreateInfo(self, request):
|
||||
r"""查看计算环境的创建信息。
|
||||
|
||||
:param request: Request instance for DescribeComputeEnvCreateInfo.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvCreateInfoRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvCreateInfoResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeComputeEnvCreateInfo", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeComputeEnvCreateInfoResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeComputeEnvCreateInfos(self, request):
|
||||
r"""用于查看计算环境创建信息列表,包括名称、描述、类型、环境参数、通知及期望节点数等。
|
||||
|
||||
:param request: Request instance for DescribeComputeEnvCreateInfos.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvCreateInfosRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvCreateInfosResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeComputeEnvCreateInfos", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeComputeEnvCreateInfosResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeComputeEnvs(self, request):
|
||||
r"""用于查看计算环境列表
|
||||
|
||||
:param request: Request instance for DescribeComputeEnvs.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvsRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeComputeEnvsResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeComputeEnvs", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeComputeEnvsResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeCvmZoneInstanceConfigInfos(self, request):
|
||||
r"""获取批量计算可用区机型配置信息
|
||||
|
||||
:param request: Request instance for DescribeCvmZoneInstanceConfigInfos.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeCvmZoneInstanceConfigInfosRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeCvmZoneInstanceConfigInfosResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeCvmZoneInstanceConfigInfos", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeCvmZoneInstanceConfigInfosResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeInstanceCategories(self, request):
|
||||
r"""目前对CVM现有实例族分类,每一类包含若干实例族。该接口用于查询实例分类信息。
|
||||
|
||||
:param request: Request instance for DescribeInstanceCategories.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeInstanceCategoriesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeInstanceCategoriesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeInstanceCategories", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeInstanceCategoriesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeJob(self, request):
|
||||
r"""用于查看一个作业的详细信息,包括内部任务(Task)和依赖(Dependence)信息。
|
||||
|
||||
:param request: Request instance for DescribeJob.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeJobRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeJobResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeJob", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeJobResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeJobMonitorData(self, request):
|
||||
r"""查询作业任务实例的资源使用监控信息。当前只支持查询弹性节点任务并且Job未删除;暂不支持计算环境类任务;该接口只支持查询作业实例时间范围之内的资源使用情况。
|
||||
|
||||
:param request: Request instance for DescribeJobMonitorData.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeJobMonitorDataRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeJobMonitorDataResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeJobMonitorData", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeJobMonitorDataResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeJobSubmitInfo(self, request):
|
||||
r"""用于查询指定作业的提交信息,其返回内容包括 JobId 和 SubmitJob 接口中作为输入参数的作业提交信息
|
||||
|
||||
:param request: Request instance for DescribeJobSubmitInfo.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeJobSubmitInfoRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeJobSubmitInfoResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeJobSubmitInfo", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeJobSubmitInfoResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeJobs(self, request):
|
||||
r"""用于查询若干个作业的概览信息
|
||||
|
||||
:param request: Request instance for DescribeJobs.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeJobsRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeJobsResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeJobs", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeJobsResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeTask(self, request):
|
||||
r"""用于查询指定任务的详细信息,包括任务内部的任务实例信息。
|
||||
|
||||
:param request: Request instance for DescribeTask.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeTaskRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeTaskResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeTask", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeTaskResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeTaskLogs(self, request):
|
||||
r"""用于获取任务多个实例标准输出和标准错误日志。
|
||||
|
||||
:param request: Request instance for DescribeTaskLogs.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeTaskLogsRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeTaskLogsResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeTaskLogs", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeTaskLogsResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DescribeTaskTemplates(self, request):
|
||||
r"""用于查询任务模板信息
|
||||
|
||||
:param request: Request instance for DescribeTaskTemplates.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DescribeTaskTemplatesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DescribeTaskTemplatesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DescribeTaskTemplates", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DescribeTaskTemplatesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def DetachInstances(self, request):
|
||||
r"""将添加到计算环境中的实例从计算环境中移出。若是由批量计算自动创建的计算节点实例则不允许移出。
|
||||
|
||||
:param request: Request instance for DetachInstances.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.DetachInstancesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.DetachInstancesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("DetachInstances", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.DetachInstancesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def ModifyComputeEnv(self, request):
|
||||
r"""用于修改计算环境属性
|
||||
|
||||
:param request: Request instance for ModifyComputeEnv.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.ModifyComputeEnvRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.ModifyComputeEnvResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("ModifyComputeEnv", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.ModifyComputeEnvResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def ModifyTaskTemplate(self, request):
|
||||
r"""用于修改任务模板
|
||||
|
||||
:param request: Request instance for ModifyTaskTemplate.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.ModifyTaskTemplateRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.ModifyTaskTemplateResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("ModifyTaskTemplate", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.ModifyTaskTemplateResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def RetryJobs(self, request):
|
||||
r"""用于重试作业中失败的任务实例。
|
||||
仅当作业处于“FAILED”状态,支持重试操作。重试操作成功后,作业会按照有向无环图中指定的任务依赖关系,依次重试各个任务中失败的任务实例。任务实例的历史信息将被重置,如同首次运行一样,参与后续的调度和执行。
|
||||
|
||||
:param request: Request instance for RetryJobs.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.RetryJobsRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.RetryJobsResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("RetryJobs", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.RetryJobsResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def SubmitJob(self, request):
|
||||
r"""用于提交一个作业
|
||||
|
||||
:param request: Request instance for SubmitJob.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.SubmitJobRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.SubmitJobResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("SubmitJob", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.SubmitJobResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TerminateComputeNode(self, request):
|
||||
r"""用于销毁计算节点。
|
||||
对于状态为CREATED、CREATION_FAILED、RUNNING和ABNORMAL的节点,允许销毁处理。
|
||||
|
||||
:param request: Request instance for TerminateComputeNode.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.TerminateComputeNodeRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.TerminateComputeNodeResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TerminateComputeNode", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TerminateComputeNodeResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TerminateComputeNodes(self, request):
|
||||
r"""用于批量销毁计算节点,不允许重复销毁同一个节点。
|
||||
|
||||
:param request: Request instance for TerminateComputeNodes.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.TerminateComputeNodesRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.TerminateComputeNodesResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TerminateComputeNodes", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TerminateComputeNodesResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TerminateJob(self, request):
|
||||
r"""用于终止作业。
|
||||
当作业处于“SUBMITTED”状态时,禁止终止操作;当作业处于“SUCCEED”状态时,终止操作不会生效。
|
||||
终止作业是一个异步过程。整个终止过程的耗时和任务总数成正比。终止的效果相当于所含的所有任务实例进行[TerminateTaskInstance](https://cloud.tencent.com/document/product/599/15908)操作。具体效果和用法可参考[TerminateTaskInstance](https://cloud.tencent.com/document/product/599/15908)。
|
||||
|
||||
:param request: Request instance for TerminateJob.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.TerminateJobRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.TerminateJobResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TerminateJob", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TerminateJobResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
|
||||
|
||||
def TerminateTaskInstance(self, request):
|
||||
r"""用于终止任务实例。
|
||||
对于状态已经为“SUCCEED”和“FAILED”的任务实例,不做处理。
|
||||
对于状态为“SUBMITTED”、“PENDING”、“RUNNABLE”的任务实例,状态将置为“FAILED”状态。
|
||||
对于状态为“STARTING”、“RUNNING”、“FAILED_INTERRUPTED”的任务实例,区分两种情况:如果未显示指定计算环境,会先销毁CVM服务器,然后将状态置为“FAILED”,具有一定耗时;如果指定了计算环境EnvId,任务实例状态置为“FAILED”,并重启执行该任务的CVM服务器,具有一定的耗时。
|
||||
对于状态为“FAILED_INTERRUPTED”的任务实例,终止操作实际成功之后,相关资源和配额才会释放。
|
||||
|
||||
:param request: Request instance for TerminateTaskInstance.
|
||||
:type request: :class:`tencentcloud.batch.v20170312.models.TerminateTaskInstanceRequest`
|
||||
:rtype: :class:`tencentcloud.batch.v20170312.models.TerminateTaskInstanceResponse`
|
||||
|
||||
"""
|
||||
try:
|
||||
params = request._serialize()
|
||||
headers = request.headers
|
||||
body = self.call("TerminateTaskInstance", params, headers=headers)
|
||||
response = json.loads(body)
|
||||
model = models.TerminateTaskInstanceResponse()
|
||||
model._deserialize(response["Response"])
|
||||
return model
|
||||
except Exception as e:
|
||||
if isinstance(e, TencentCloudSDKException):
|
||||
raise
|
||||
else:
|
||||
raise TencentCloudSDKException(type(e).__name__, str(e))
|
||||
@@ -0,0 +1,582 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. 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.
|
||||
|
||||
|
||||
|
||||
from tencentcloud.common.abstract_client_async import AbstractClient
|
||||
from tencentcloud.batch.v20170312 import models
|
||||
from typing import Dict
|
||||
|
||||
|
||||
class BatchClient(AbstractClient):
|
||||
_apiVersion = '2017-03-12'
|
||||
_endpoint = 'batch.tencentcloudapi.com'
|
||||
_service = 'batch'
|
||||
|
||||
async def AttachInstances(
|
||||
self,
|
||||
request: models.AttachInstancesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.AttachInstancesResponse:
|
||||
"""
|
||||
此接口可将已存在实例添加到计算环境中。
|
||||
实例需要满足如下条件:<br/>
|
||||
1.实例不在批量计算系统中。<br/>
|
||||
2.实例状态要求处于运行中。<br/>
|
||||
3.支持预付费实例,按小时后付费实例,专享子机实例。不支持竞价实例。<br/>
|
||||
|
||||
此接口会将加入到计算环境中的实例重设UserData和重装操作系统。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "AttachInstances"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.AttachInstancesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def CreateComputeEnv(
|
||||
self,
|
||||
request: models.CreateComputeEnvRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateComputeEnvResponse:
|
||||
"""
|
||||
用于创建计算环境
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateComputeEnv"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateComputeEnvResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def CreateTaskTemplate(
|
||||
self,
|
||||
request: models.CreateTaskTemplateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.CreateTaskTemplateResponse:
|
||||
"""
|
||||
用于创建任务模板
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "CreateTaskTemplate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.CreateTaskTemplateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DeleteComputeEnv(
|
||||
self,
|
||||
request: models.DeleteComputeEnvRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DeleteComputeEnvResponse:
|
||||
"""
|
||||
用于删除计算环境
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DeleteComputeEnv"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DeleteComputeEnvResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DeleteJob(
|
||||
self,
|
||||
request: models.DeleteJobRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DeleteJobResponse:
|
||||
"""
|
||||
用于删除作业记录。
|
||||
删除作业的效果相当于删除作业相关的所有信息。删除成功后,作业相关的所有信息都无法查询。
|
||||
待删除的作业必须处于完结状态,且其内部包含的所有任务实例也必须处于完结状态,否则会禁止操作。完结状态,是指处于 SUCCEED 或 FAILED 状态。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DeleteJob"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DeleteJobResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DeleteTaskTemplates(
|
||||
self,
|
||||
request: models.DeleteTaskTemplatesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DeleteTaskTemplatesResponse:
|
||||
"""
|
||||
用于删除任务模板信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DeleteTaskTemplates"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DeleteTaskTemplatesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeAvailableCvmInstanceTypes(
|
||||
self,
|
||||
request: models.DescribeAvailableCvmInstanceTypesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeAvailableCvmInstanceTypesResponse:
|
||||
"""
|
||||
查看可用的CVM机型配置信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeAvailableCvmInstanceTypes"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeAvailableCvmInstanceTypesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeComputeEnv(
|
||||
self,
|
||||
request: models.DescribeComputeEnvRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeComputeEnvResponse:
|
||||
"""
|
||||
用于查询计算环境的详细信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeComputeEnv"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeComputeEnvResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeComputeEnvActivities(
|
||||
self,
|
||||
request: models.DescribeComputeEnvActivitiesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeComputeEnvActivitiesResponse:
|
||||
"""
|
||||
用于查询计算环境的活动信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeComputeEnvActivities"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeComputeEnvActivitiesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeComputeEnvCreateInfo(
|
||||
self,
|
||||
request: models.DescribeComputeEnvCreateInfoRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeComputeEnvCreateInfoResponse:
|
||||
"""
|
||||
查看计算环境的创建信息。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeComputeEnvCreateInfo"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeComputeEnvCreateInfoResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeComputeEnvCreateInfos(
|
||||
self,
|
||||
request: models.DescribeComputeEnvCreateInfosRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeComputeEnvCreateInfosResponse:
|
||||
"""
|
||||
用于查看计算环境创建信息列表,包括名称、描述、类型、环境参数、通知及期望节点数等。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeComputeEnvCreateInfos"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeComputeEnvCreateInfosResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeComputeEnvs(
|
||||
self,
|
||||
request: models.DescribeComputeEnvsRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeComputeEnvsResponse:
|
||||
"""
|
||||
用于查看计算环境列表
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeComputeEnvs"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeComputeEnvsResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeCvmZoneInstanceConfigInfos(
|
||||
self,
|
||||
request: models.DescribeCvmZoneInstanceConfigInfosRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeCvmZoneInstanceConfigInfosResponse:
|
||||
"""
|
||||
获取批量计算可用区机型配置信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeCvmZoneInstanceConfigInfos"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeCvmZoneInstanceConfigInfosResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeInstanceCategories(
|
||||
self,
|
||||
request: models.DescribeInstanceCategoriesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeInstanceCategoriesResponse:
|
||||
"""
|
||||
目前对CVM现有实例族分类,每一类包含若干实例族。该接口用于查询实例分类信息。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeInstanceCategories"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeInstanceCategoriesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeJob(
|
||||
self,
|
||||
request: models.DescribeJobRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeJobResponse:
|
||||
"""
|
||||
用于查看一个作业的详细信息,包括内部任务(Task)和依赖(Dependence)信息。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeJob"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeJobResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeJobMonitorData(
|
||||
self,
|
||||
request: models.DescribeJobMonitorDataRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeJobMonitorDataResponse:
|
||||
"""
|
||||
查询作业任务实例的资源使用监控信息。当前只支持查询弹性节点任务并且Job未删除;暂不支持计算环境类任务;该接口只支持查询作业实例时间范围之内的资源使用情况。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeJobMonitorData"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeJobMonitorDataResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeJobSubmitInfo(
|
||||
self,
|
||||
request: models.DescribeJobSubmitInfoRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeJobSubmitInfoResponse:
|
||||
"""
|
||||
用于查询指定作业的提交信息,其返回内容包括 JobId 和 SubmitJob 接口中作为输入参数的作业提交信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeJobSubmitInfo"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeJobSubmitInfoResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeJobs(
|
||||
self,
|
||||
request: models.DescribeJobsRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeJobsResponse:
|
||||
"""
|
||||
用于查询若干个作业的概览信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeJobs"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeJobsResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeTask(
|
||||
self,
|
||||
request: models.DescribeTaskRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeTaskResponse:
|
||||
"""
|
||||
用于查询指定任务的详细信息,包括任务内部的任务实例信息。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeTask"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeTaskResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeTaskLogs(
|
||||
self,
|
||||
request: models.DescribeTaskLogsRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeTaskLogsResponse:
|
||||
"""
|
||||
用于获取任务多个实例标准输出和标准错误日志。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeTaskLogs"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeTaskLogsResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DescribeTaskTemplates(
|
||||
self,
|
||||
request: models.DescribeTaskTemplatesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DescribeTaskTemplatesResponse:
|
||||
"""
|
||||
用于查询任务模板信息
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DescribeTaskTemplates"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DescribeTaskTemplatesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def DetachInstances(
|
||||
self,
|
||||
request: models.DetachInstancesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.DetachInstancesResponse:
|
||||
"""
|
||||
将添加到计算环境中的实例从计算环境中移出。若是由批量计算自动创建的计算节点实例则不允许移出。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "DetachInstances"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.DetachInstancesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def ModifyComputeEnv(
|
||||
self,
|
||||
request: models.ModifyComputeEnvRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.ModifyComputeEnvResponse:
|
||||
"""
|
||||
用于修改计算环境属性
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "ModifyComputeEnv"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.ModifyComputeEnvResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def ModifyTaskTemplate(
|
||||
self,
|
||||
request: models.ModifyTaskTemplateRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.ModifyTaskTemplateResponse:
|
||||
"""
|
||||
用于修改任务模板
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "ModifyTaskTemplate"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.ModifyTaskTemplateResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def RetryJobs(
|
||||
self,
|
||||
request: models.RetryJobsRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.RetryJobsResponse:
|
||||
"""
|
||||
用于重试作业中失败的任务实例。
|
||||
仅当作业处于“FAILED”状态,支持重试操作。重试操作成功后,作业会按照有向无环图中指定的任务依赖关系,依次重试各个任务中失败的任务实例。任务实例的历史信息将被重置,如同首次运行一样,参与后续的调度和执行。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "RetryJobs"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.RetryJobsResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def SubmitJob(
|
||||
self,
|
||||
request: models.SubmitJobRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.SubmitJobResponse:
|
||||
"""
|
||||
用于提交一个作业
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "SubmitJob"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.SubmitJobResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TerminateComputeNode(
|
||||
self,
|
||||
request: models.TerminateComputeNodeRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TerminateComputeNodeResponse:
|
||||
"""
|
||||
用于销毁计算节点。
|
||||
对于状态为CREATED、CREATION_FAILED、RUNNING和ABNORMAL的节点,允许销毁处理。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TerminateComputeNode"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TerminateComputeNodeResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TerminateComputeNodes(
|
||||
self,
|
||||
request: models.TerminateComputeNodesRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TerminateComputeNodesResponse:
|
||||
"""
|
||||
用于批量销毁计算节点,不允许重复销毁同一个节点。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TerminateComputeNodes"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TerminateComputeNodesResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TerminateJob(
|
||||
self,
|
||||
request: models.TerminateJobRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TerminateJobResponse:
|
||||
"""
|
||||
用于终止作业。
|
||||
当作业处于“SUBMITTED”状态时,禁止终止操作;当作业处于“SUCCEED”状态时,终止操作不会生效。
|
||||
终止作业是一个异步过程。整个终止过程的耗时和任务总数成正比。终止的效果相当于所含的所有任务实例进行[TerminateTaskInstance](https://cloud.tencent.com/document/product/599/15908)操作。具体效果和用法可参考[TerminateTaskInstance](https://cloud.tencent.com/document/product/599/15908)。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TerminateJob"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TerminateJobResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
|
||||
async def TerminateTaskInstance(
|
||||
self,
|
||||
request: models.TerminateTaskInstanceRequest,
|
||||
opts: Dict = None,
|
||||
) -> models.TerminateTaskInstanceResponse:
|
||||
"""
|
||||
用于终止任务实例。
|
||||
对于状态已经为“SUCCEED”和“FAILED”的任务实例,不做处理。
|
||||
对于状态为“SUBMITTED”、“PENDING”、“RUNNABLE”的任务实例,状态将置为“FAILED”状态。
|
||||
对于状态为“STARTING”、“RUNNING”、“FAILED_INTERRUPTED”的任务实例,区分两种情况:如果未显示指定计算环境,会先销毁CVM服务器,然后将状态置为“FAILED”,具有一定耗时;如果指定了计算环境EnvId,任务实例状态置为“FAILED”,并重启执行该任务的CVM服务器,具有一定的耗时。
|
||||
对于状态为“FAILED_INTERRUPTED”的任务实例,终止操作实际成功之后,相关资源和配额才会释放。
|
||||
"""
|
||||
|
||||
kwargs = {}
|
||||
kwargs["action"] = "TerminateTaskInstance"
|
||||
kwargs["params"] = request._serialize()
|
||||
kwargs["resp_cls"] = models.TerminateTaskInstanceResponse
|
||||
kwargs["headers"] = request.headers
|
||||
kwargs["opts"] = opts or {}
|
||||
|
||||
return await self.call_and_deserialize(**kwargs)
|
||||
@@ -0,0 +1,231 @@
|
||||
# -*- coding: utf8 -*-
|
||||
# Copyright (c) 2017-2025 Tencent. 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.
|
||||
|
||||
|
||||
# ComputeEnv 和 EnvId 必须指定一个(且只有一个)参数。
|
||||
ALLOWEDONEATTRIBUTEINENVIDANDCOMPUTEENV = 'AllowedOneAttributeInEnvIdAndComputeEnv'
|
||||
|
||||
# 内部错误。
|
||||
INTERNALERROR = 'InternalError'
|
||||
|
||||
# 调用CAM API返回错误。
|
||||
INTERNALERROR_CALLCAM = 'InternalError.CallCam'
|
||||
|
||||
# 调用Cpm API返回错误。
|
||||
INTERNALERROR_CALLCPMAPI = 'InternalError.CallCpmAPI'
|
||||
|
||||
# 调用CVM API返回错误。
|
||||
INTERNALERROR_CALLCVM = 'InternalError.CallCvm'
|
||||
|
||||
# 获取Tag错误。
|
||||
INTERNALERROR_CALLTAGAPI = 'InternalError.CallTagAPI'
|
||||
|
||||
# 指定的Filter不被支持。
|
||||
INVALIDFILTER = 'InvalidFilter'
|
||||
|
||||
# 非法的计算节点ID格式。
|
||||
INVALIDPARAMETER_COMPUTENODEIDMALFORMED = 'InvalidParameter.ComputeNodeIdMalformed'
|
||||
|
||||
# 非法的CVM参数。
|
||||
INVALIDPARAMETER_CVMPARAMETERS = 'InvalidParameter.CvmParameters'
|
||||
|
||||
# 计算环境描述过长。
|
||||
INVALIDPARAMETER_ENVDESCRIPTIONTOOLONG = 'InvalidParameter.EnvDescriptionTooLong'
|
||||
|
||||
# 非法的计算环境ID格式。
|
||||
INVALIDPARAMETER_ENVIDMALFORMED = 'InvalidParameter.EnvIdMalformed'
|
||||
|
||||
# 计算环境名称过长。
|
||||
INVALIDPARAMETER_ENVNAMETOOLONG = 'InvalidParameter.EnvNameTooLong'
|
||||
|
||||
# 镜像ID不正确。
|
||||
INVALIDPARAMETER_IMAGEIDMALFORMED = 'InvalidParameter.ImageIdMalformed'
|
||||
|
||||
# 非法的参数组合。
|
||||
INVALIDPARAMETER_INVALIDPARAMETERCOMBINATION = 'InvalidParameter.InvalidParameterCombination'
|
||||
|
||||
# 作业描述过长。
|
||||
INVALIDPARAMETER_JOBDESCRIPTIONTOOLONG = 'InvalidParameter.JobDescriptionTooLong'
|
||||
|
||||
# 非法的作业ID格式。
|
||||
INVALIDPARAMETER_JOBIDMALFORMED = 'InvalidParameter.JobIdMalformed'
|
||||
|
||||
# 作业名称过长。
|
||||
INVALIDPARAMETER_JOBNAMETOOLONG = 'InvalidParameter.JobNameTooLong'
|
||||
|
||||
# 重复的消息通知事件名称。
|
||||
INVALIDPARAMETER_NOTIFICATIONEVENTNAMEDUPLICATE = 'InvalidParameter.NotificationEventNameDuplicate'
|
||||
|
||||
# 非法的主题名称。
|
||||
INVALIDPARAMETER_NOTIFICATIONTOPICNAME = 'InvalidParameter.NotificationTopicName'
|
||||
|
||||
# 主题名称过长。
|
||||
INVALIDPARAMETER_NOTIFICATIONTOPICNAMETOOLONG = 'InvalidParameter.NotificationTopicNameTooLong'
|
||||
|
||||
# 非法的任务名称。
|
||||
INVALIDPARAMETER_TASKNAME = 'InvalidParameter.TaskName'
|
||||
|
||||
# 任务名称过长。
|
||||
INVALIDPARAMETER_TASKNAMETOOLONG = 'InvalidParameter.TaskNameTooLong'
|
||||
|
||||
# 任务模板描述过长。
|
||||
INVALIDPARAMETER_TASKTEMPLATEDESCRIPTIONTOOLONG = 'InvalidParameter.TaskTemplateDescriptionTooLong'
|
||||
|
||||
# 非法的任务模板ID格式。
|
||||
INVALIDPARAMETER_TASKTEMPLATEIDMALFORMED = 'InvalidParameter.TaskTemplateIdMalformed'
|
||||
|
||||
# 非法的任务模板名称。
|
||||
INVALIDPARAMETER_TASKTEMPLATENAME = 'InvalidParameter.TaskTemplateName'
|
||||
|
||||
# 任务模板名称过长。
|
||||
INVALIDPARAMETER_TASKTEMPLATENAMETOOLONG = 'InvalidParameter.TaskTemplateNameTooLong'
|
||||
|
||||
# TaskTemplateName、TaskTemplateDescription和TaskTemplateInfo至少包含一项。
|
||||
INVALIDPARAMETERATLEASTONEATTRIBUTE = 'InvalidParameterAtLeastOneAttribute'
|
||||
|
||||
# 参数取值错误。
|
||||
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
|
||||
|
||||
# 计算环境参数校验失败。
|
||||
INVALIDPARAMETERVALUE_COMPUTEENV = 'InvalidParameterValue.ComputeEnv'
|
||||
|
||||
# 找不到依赖任务定义。
|
||||
INVALIDPARAMETERVALUE_DEPENDENCENOTFOUNDTASKNAME = 'InvalidParameterValue.DependenceNotFoundTaskName'
|
||||
|
||||
# 禁止环状任务依赖关系。
|
||||
INVALIDPARAMETERVALUE_DEPENDENCEUNFEASIBLE = 'InvalidParameterValue.DependenceUnfeasible'
|
||||
|
||||
# 实例ID重复。
|
||||
INVALIDPARAMETERVALUE_INSTANCEIDDUPLICATED = 'InvalidParameterValue.InstanceIdDuplicated'
|
||||
|
||||
# 不支持指定的实例类型。
|
||||
INVALIDPARAMETERVALUE_INSTANCETYPE = 'InvalidParameterValue.InstanceType'
|
||||
|
||||
# 实例类型不能有重复值。
|
||||
INVALIDPARAMETERVALUE_INSTANCETYPEDUPLICATE = 'InvalidParameterValue.InstanceTypeDuplicate'
|
||||
|
||||
# 实例类型列表不能为空。
|
||||
INVALIDPARAMETERVALUE_INSTANCETYPESEMPTY = 'InvalidParameterValue.InstanceTypesEmpty'
|
||||
|
||||
# DataTypeAny不合法。
|
||||
INVALIDPARAMETERVALUE_INVALIDDATATYPEANY = 'InvalidParameterValue.InvalidDataTypeAny'
|
||||
|
||||
# Filter参数不正确。
|
||||
INVALIDPARAMETERVALUE_INVALIDFILTER = 'InvalidParameterValue.InvalidFilter'
|
||||
|
||||
# 可用区和地域不匹配。
|
||||
INVALIDPARAMETERVALUE_INVALIDZONEMISMATCHREGION = 'InvalidParameterValue.InvalidZoneMismatchRegion'
|
||||
|
||||
# Filter参数值数量超过限制。
|
||||
INVALIDPARAMETERVALUE_LIMITEXCEEDED = 'InvalidParameterValue.LimitExceeded'
|
||||
|
||||
# 非法的本地存储路径。
|
||||
INVALIDPARAMETERVALUE_LOCALPATH = 'InvalidParameterValue.LocalPath'
|
||||
|
||||
# 重试次数过大。
|
||||
INVALIDPARAMETERVALUE_MAXRETRYCOUNT = 'InvalidParameterValue.MaxRetryCount'
|
||||
|
||||
# 非法的负值参数。
|
||||
INVALIDPARAMETERVALUE_NEGATIVE = 'InvalidParameterValue.Negative'
|
||||
|
||||
# 参数值不是浮点型。
|
||||
INVALIDPARAMETERVALUE_NOTFLOAT = 'InvalidParameterValue.NotFloat'
|
||||
|
||||
# 非法的存储路径格式。
|
||||
INVALIDPARAMETERVALUE_REMOTESTORAGEPATH = 'InvalidParameterValue.RemoteStoragePath'
|
||||
|
||||
# 非法的存储类型。
|
||||
INVALIDPARAMETERVALUE_REMOTESTORAGESCHEMETYPE = 'InvalidParameterValue.RemoteStorageSchemeType'
|
||||
|
||||
# 指定的ResourceType不合法。
|
||||
INVALIDPARAMETERVALUE_RESOURCETYPE = 'InvalidParameterValue.ResourceType'
|
||||
|
||||
# 提交任务时指定的task实例副本参数不符合预期
|
||||
INVALIDPARAMETERVALUE_TASKINSTANCENUM = 'InvalidParameterValue.TaskInstanceNum'
|
||||
|
||||
# Zone不可用。
|
||||
INVALIDPARAMETERVALUE_UNAVAILABLEZONE = 'InvalidParameterValue.UnavailableZone'
|
||||
|
||||
# 批量计算不支持的机型付费类型。
|
||||
INVALIDPARAMETERVALUE_UNSUPPORTEDBATCHINSTANCECHARGETYPE = 'InvalidParameterValue.UnsupportedBatchInstanceChargeType'
|
||||
|
||||
# 指定的zone不存在。
|
||||
INVALIDZONE_MISMATCHREGION = 'InvalidZone.MismatchRegion'
|
||||
|
||||
# 计算环境配额不足。
|
||||
LIMITEXCEEDED_COMPUTEENVQUOTA = 'LimitExceeded.ComputeEnvQuota'
|
||||
|
||||
# CPU配额不足。
|
||||
LIMITEXCEEDED_CPUQUOTA = 'LimitExceeded.CpuQuota'
|
||||
|
||||
# 作业配额不足。
|
||||
LIMITEXCEEDED_JOBQUOTA = 'LimitExceeded.JobQuota'
|
||||
|
||||
# 任务模板配额不足。
|
||||
LIMITEXCEEDED_TASKTEMPLATEQUOTA = 'LimitExceeded.TaskTemplateQuota'
|
||||
|
||||
# Job在使用中。
|
||||
RESOURCEINUSE_JOB = 'ResourceInUse.Job'
|
||||
|
||||
# 指定计算环境不存在。
|
||||
RESOURCENOTFOUND_COMPUTEENV = 'ResourceNotFound.ComputeEnv'
|
||||
|
||||
# 指定计算节点不存在。
|
||||
RESOURCENOTFOUND_COMPUTENODE = 'ResourceNotFound.ComputeNode'
|
||||
|
||||
# 指定作业不存在。
|
||||
RESOURCENOTFOUND_JOB = 'ResourceNotFound.Job'
|
||||
|
||||
# 指定作业任务不存在。
|
||||
RESOURCENOTFOUND_TASK = 'ResourceNotFound.Task'
|
||||
|
||||
# 指定任务实例不存在。
|
||||
RESOURCENOTFOUND_TASKINSTANCE = 'ResourceNotFound.TaskInstance'
|
||||
|
||||
# 指定任务模板ID不存在。
|
||||
RESOURCENOTFOUND_TASKTEMPLATE = 'ResourceNotFound.TaskTemplate'
|
||||
|
||||
# 禁止使用批量计算服务。
|
||||
UNAUTHORIZEDOPERATION_USERNOTALLOWEDTOUSEBATCH = 'UnauthorizedOperation.UserNotAllowedToUseBatch'
|
||||
|
||||
# 未知参数错误。
|
||||
UNKNOWNPARAMETER = 'UnknownParameter'
|
||||
|
||||
# 操作不支持。
|
||||
UNSUPPORTEDOPERATION = 'UnsupportedOperation'
|
||||
|
||||
# 处理其他请求,禁止删除操作。
|
||||
UNSUPPORTEDOPERATION_ACCEPTOTHERREQUEST = 'UnsupportedOperation.AcceptOtherRequest'
|
||||
|
||||
# 计算环境正在接受请求。
|
||||
UNSUPPORTEDOPERATION_COMPUTEENVACCEPTOTHERREQUEST = 'UnsupportedOperation.ComputeEnvAcceptOtherRequest'
|
||||
|
||||
# 禁止删除操作。
|
||||
UNSUPPORTEDOPERATION_COMPUTEENVOPERATION = 'UnsupportedOperation.ComputeEnvOperation'
|
||||
|
||||
# 禁止终止计算节点。
|
||||
UNSUPPORTEDOPERATION_COMPUTENODEFORBIDTERMINATE = 'UnsupportedOperation.ComputeNodeForbidTerminate'
|
||||
|
||||
# 计算节点停止中。
|
||||
UNSUPPORTEDOPERATION_COMPUTENODEISTERMINATING = 'UnsupportedOperation.ComputeNodeIsTerminating'
|
||||
|
||||
# 不允许将该实例添加到计算环境中。
|
||||
UNSUPPORTEDOPERATION_INSTANCESNOTALLOWTOATTACH = 'UnsupportedOperation.InstancesNotAllowToAttach'
|
||||
|
||||
# 缩容时,缩容数大于现有计算节点数。
|
||||
UNSUPPORTEDOPERATION_NOTENOUGHCOMPUTENODESTOTERMINATE = 'UnsupportedOperation.NotEnoughComputeNodesToTerminate'
|
||||
|
||||
# 指定计算环境的任务实例禁止该操作。
|
||||
UNSUPPORTEDOPERATION_TERMINATEOPERATIONWITHENVID = 'UnsupportedOperation.TerminateOperationWithEnvId'
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user