IDC

创建作业(DAG类型) - 批量计算

作者:admin 2021-09-20 我要评论

CreateJob 描述 创建(提交)一个DAG类型的作业。 请求语法样例 POST / jobs { "Name" : "testJob" , "Description" : "BatchCompute demo job" , "JobFailOnIns...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

CreateJob

描述

创建(提交)一个DAG类型的作业。

请求语法样例

  1. POST /jobs
  2. {
  3. "Name": "testJob",
  4. "Description": "BatchCompute demo job",
  5. "JobFailOnInstanceFail": true,
  6. "Priority": 1,
  7. "Type": "DAG",
  8. "AutoRelease": false,
  9. "Notification": {
  10. "Topic": {
  11. "Name": "test-topic",
  12. "Endpoint": "http://[UserId].mns.[Region].aliyuncs.com/",
  13. "Events": [
  14. "OnJobWaiting",
  15. "OnJobRunning",
  16. "OnJobStopped",
  17. "OnJobFinished",
  18. "OnJobFailed",
  19. "OnTaskWaiting",
  20. "OnTaskRunning",
  21. "OnTaskStopped",
  22. "OnTaskFinished",
  23. "OnTaskFailed",
  24. "OnInstanceWaiting",
  25. "OnInstanceRunning",
  26. "OnInstanceStopped",
  27. "OnInstanceFinished",
  28. "OnInstanceFailed",
  29. "OnPriorityChange"
  30. ]
  31. }
  32. },
  33. "DAG": {
  34. "Dependencies": {},
  35. "Tasks": {
  36. "taskA": {
  37. "AutoCluster": {
  38. "Configs": {
  39. "Disks": {
  40. "DataDisk": {
  41. "MountPoint": "/home/mydisk/",
  42. "Size": 0,
  43. "Type": "ephemeral"
  44. },
  45. "SystemDisk": {
  46. "Size": 40,
  47. "Type": "ephemeral"
  48. }
  49. },
  50. "Mounts": {
  51. "Entries": [
  52. {
  53. "Destination": "/home/admin/mount-dest",
  54. "Source": "oss://your-bucket/mount-source",
  55. "WriteSupport": false
  56. }
  57. ],
  58. "Locale": "GBK",
  59. "Lock": false,
  60. "CacheSupport": true,
  61. "NAS": {
  62. "AccessGroup": [
  63. "group1",
  64. "group2"
  65. ],
  66. "FileSystem": [
  67. "filesystem1",
  68. "filesystem2"
  69. ]
  70. },
  71. "OSS": {
  72. "AccessKeyId": "",
  73. "AccessKeySecret": "",
  74. "AccessSecurityToken": ""
  75. }
  76. },
  77. "Networks": {
  78. "Classic": {
  79. "AllowIpAddress": [],
  80. "AllowIpAddressEgress": [],
  81. "AllowSecurityGroup": [],
  82. "AllowSecurityGroupEgress": []
  83. },
  84. "VPC": {
  85. "CidrBlock": "192.168.0.0/16"
  86. }
  87. }
  88. },
  89. "ECSImageId": "",
  90. "ImageId": "img-ubuntu",
  91. "InstanceType": "bcs.a2.large",
  92. "ResourceType": "OnDemand",
  93. "SpotStrategy": "SpotAsPriceGo",
  94. "SpotPriceLimit": 0.0,
  95. "UserData": {},
  96. "ReserveOnFail": false
  97. },
  98. "ClusterId": "cls-6kir9pdp3lg6220g418002",
  99. "InputMapping": {
  100. "oss://bucket/tmp/": "/home/mount1/"
  101. },
  102. "InstanceCount": 1,
  103. "LogMapping": {},
  104. "MaxRetryCount": 0,
  105. "OutputMapping": {
  106. "/home/mount1": "oss://bucket/tmp/"
  107. },
  108. "Mounts": {
  109. "Entries": [
  110. {
  111. "Destination": "/home/admin/mount-dest",
  112. "Source": "oss://your-bucket/mount-source",
  113. "WriteSupport": false
  114. }
  115. ],
  116. "Locale": "GBK",
  117. "Lock": false,
  118. "NAS": {
  119. "AccessGroup": [
  120. "group1",
  121. "group2"
  122. ],
  123. "FileSystem": [
  124. "filesystem1",
  125. "filesystem2"
  126. ]
  127. },
  128. "OSS": {
  129. "AccessKeyId": "",
  130. "AccessKeySecret": "",
  131. "AccessSecurityToken": ""
  132. }
  133. },
  134. "Parameters": {
  135. "Command": {
  136. "CommandLine": "python worker.py",
  137. "EnvVars": {},
  138. "PackagePath": "oss://bucket/tests/worker.tar.gz"
  139. },
  140. "InputMappingConfig": {
  141. "Locale": "GBK",
  142. "Lock": false
  143. },
  144. "StderrRedirectPath": "oss://bucket/tests/logs/",
  145. "StdoutRedirectPath": "oss://bucket/tests/logs/"
  146. },
  147. "Timeout": 172800,
  148. }
  149. }
  150. }
  151. }

属性说明

属性名称 类型 是否必须 描述
Name string 作业名称。
Description string 作业的描述信息。
Priority int 作业优先级,范围0-1000,数值越高,优先级越高。
Type string 目前仅支持有向无环图(directed acycline graph,DAG)形式描述任务。
JobFailOnInstanceFail bool 取值为true表示Instance失败会导致Job失败。
AutoRelease bool 取值为true表示Job运行成功后系统会自动删除改Job。默认false。
Notification object 消息通知配置,用户指定消息事件Notification
DAG object DAG描述。
Tasks object 任务描述。
Parameters object 任务参数详情。
Command object 用户程序相关命令行参数。
CommandLine string 执行用户程序的命令。CommandLine不等同于SHELL,仅支持“解释器 + 脚本”方式,比如“python test.py”或“sh test.sh”
PackagePath string 用户程序所在OSS路径。
EnvVars string 设置用户程序执行时的环境变量。
InputMappingConfig object NFS挂载服务配置项。
Locale string OSS object挂载到本地时使用的字符集。可选范围包括GBK、GB2312-80、BIG5、ANSI、EUC-JP、EUC-TW、EUC-KR、SHIFT-JIS、KSC5601等。
Lock bool NFS挂载服务是否支持网络文件锁。
StdoutRedirectPath string 标准输出的OSS路径。
StderrRedirectPath string 标准错误的OSS路径。
InputMapping object OSS对本地路径映射。
OutputMapping object 本地路径对OSS映射。
LogMapping object 本地日志路径对OSS映射。OSS是目录,以斜杠结尾。OSS日志名称格式:{本地日志名}.{作业ID}.{任务ID}.{实例ID},比如output_log.job-0000000056A6E991000001780000000D.Echo.0
Timeout int 实例最长执行时间。
InstanceCount int 实例数量。
MaxRetryCount int 最大重试次数,默认为0。
ClusterId string 集群标识符。该参数与AutoCluster(匿名集群)必须选择一个
AutoCluster object 匿名集群。Auto集群描述,AutoCluster和ClusterId必须一个是有效的,而且只能有一个是有效的。
Dependencies object 描述任务之间依赖关系的object结构,其中key为源任务名称,value为目标任务名称 列表,可以描述一对多的顺序关系。

AutoCluster

属性名称 类型 是否必须 描述
ImageId string BatchCompute镜像的ID
ECSImageId string ECS镜像的ID,必须取值为合法的ECS镜像ID。ECSImageId和ImageId必须只能一个取合法的值,另外一个必须为空。
InstanceType string 构建集群的实例类型。目前支持的ECS实例类型
ResourceType string 资源类型。支持“OnDemand(按需资源)”,“Spot(竞价型资源)”。
SpotStrategy String 实例的竞价策略,只有在ResourceType为Spot的情况下有效。
取值范围:
SpotWithPriceLimit:设置上限价格的竞价实例;
SpotAsPriceGo:系统自动出价,最高按量付费价格。
SpotPriceLimit Float 实例的每小时最高价格(每个实例规格的价格而非每核小时的价格)。支持最大 3 位小数,SpotStrategy 为 SpotWithPriceLimit 生效。
UserData object 一个KeyValue映射,用户自定义的信息,使用ECS的metaserver获取。
Configs object 集群的一些配置信息,比如实例的磁盘配置,由Configs描述。
ReserveOnFail Bool 任务失败时不释放相关的虚拟机,会继续收取这些资源的费用直到用户删除作业,默认为False,仅用于调查问题。
DependencyIsvService string 执行程序依赖的阿里云提供的ISV服务,目前提供的ISV服务有:“GTX”,默认为””,不依赖任何ISV服务。

返回信息

返回成功

返回201状态码以及Job的id,如下。

  1. {
  2. "Id":"job-xxx"
  3. }

属性说明

属性名称 类型 是否必须 描述
Id string 作业标识符。

错误信息

状态码 错误码 错误信息 语义
400 IdempotentTokenMismatch Specified idempotent token mismatch. 说明该token已经被使用过,并且该请求参数与之前的请求不一样。
400 InvalidJsonFormat The request body has an invalid json format. 请求body是一个非法的json格式。
400 InvalidHttpBody Specified parameter HttpBody is not valid. Its type must be object. http body必须是一个object。
400 MissingName Name is mandatory for this action. 缺少Name参数。
400 InvalidName Specified parameter Name is not valid. Its type must be string. Name必须是一个string。
400 InvalidName Specified parameter Name is not valid. Its length must be in [1, 64]. Name的长度必须在1与64之间。
400 InvalidName Specified parameter Name is not valid. It must only contain characters within [a-zA-Z0-9_-], and must not start with [0-9]. Name中只能包括字母数字和_-,但不能以数字开头。
400 InvalidDescription Specified parameter Description is not valid. Its type must be string. Description必须是一个string。
400 InvalidDescription Specified parameter Description is not valid. Its length must be in [0, 1024]. Description的长度必须在0与1024之间。
400 InvalidPriority Specified parameter Priority is not valid. Its type must be integer. Priority必须是一个integer。
400 InvalidPriority Specified parameter Priority is not valid. It must be in [0, 1000]. Priority的大小必须在0与1000之间。
400 InvalidJobFailOnInstanceFail Specified parameter JobFailOnInstanceFail is not valid. Its type must be boolean. JobFailOnInstanceFail必须是一个布尔类型。
400 MissingType Type is mandatory for this action. 缺少Type参数。
400 InvalidType Specified parameter Type is not valid. Type参数取值不合法。
400 MissingDAG DAG is mandatory for this action. 缺少DAG参数。
400 InvalidDAG Specified parameter DAG is not valid. Its type must be object. DAG必须是一个object。
400 MissingTasks Tasks is mandatory for this action. 缺少Tasks参数。
400 InvalidTasks Specified parameter Tasks is not valid. Its type must be object. Tasks必须是一个object。
400 InvalidTasks Specified parameter Tasks is not valid. Its size must be in [1, 16]. UserData的大小必须在1与16之间。
400 InvalidTasks.{key} Specified parameter Tasks.{key} is not valid. Its length must be in [1, 64]. Tasks.{key}的大小必须在1与64之间。
400 InvalidTasks.{key} Specified parameter Tasks.{key} is not valid. It must only contain characters within [a-zA-Z0-9_-], and must not start with [0-9].. Tasks.{key}中只能包括字母数字和_-,但不能以数字开头。
403 QuotaExhausted.MaxJobCount The MaxJobCount ({value}) quota is exhausted. Job数量不能超过{value}。
403 QuotaExhausted.MaxJobTaskCount The MaxJobTaskCount ({value}) quota is exhausted. 一个Job中的Task的数量不能超过{value}。
403 QuotaExhausted.MaxTaskInstanceCount The MaxTaskInstanceCount ({value}) quota is exhausted. 一个Task的InstanceCount不能超过{value}。
403 QuotaExhausted.MaxInstanceTimeout The MaxInstanceTimeout ({value}) quota is exhausted. 一个Instance的Timeout不能超过{value}。
400 MissingParameters Parameters is mandatory for this action. 缺少Parameters参数。
400 InvalidParameters Specified parameter Parameters is not valid. Its type must be object. Parameters必须是一个object。
400 MissingCommand Command is mandatory for this action. 缺少Command参数。
400 InvalidCommand Specified parameter Command is not valid. Its type must be object. Command必须是一个object。
400 MissingCommandLine CommandLine is mandatory for this action. 缺少CommandLine参数。
400 InvalidCommandLine Specified parameter CommandLine is not valid. Its type must be string. CommandLine必须是一个string。
400 InvalidCommandLine Specified parameter CommandLine is not valid. Its length must be in [0, 1024]. CommandLine的长度必须在0与1024之间。
400 InvalidPackagePath Specified parameter PackagePath is not valid. Its type must be string. PackagePath必须是一个string。
400 InvalidPackagePath Specified parameter PackagePath is not valid. Its length must be in [0, 1024]. PackagePath的长度必须在0与1024之间。
400 InvalidPackagePath Specified parameter PackagePath is not valid. OSS path must start with ‘oss://‘, must end with ‘/‘ if it is a folder, and must not end with ‘/‘ if it is a file. PackagePath必须是一个合法的OSS路径。
400 InvalidEnvVars Specified parameter EnvVars is not valid. Its type must be object. EnvVars必须是一个object。
400 InvalidEnvVars Specified parameter EnvVars is not valid. Its size must be in [0, 64]. EnvVars的大小必须在0与64之间。
400 InvalidEnvVars.{key} Specified parameter EnvVars.{key} is not valid. Its length must be in [1, 128]. EnvVars.{key}的大小必须在1与128之间。
400 InvalidEnvVars.{key}.value Specified parameter EnvVars.{key}.value is not valid. Its type must be string. EnvVars.{key}对应的Value必须是一个string。
400 InvalidEnvVars.{key}.value Specified parameter EnvVars.{key}.value is not valid. Its length must be in [0, 1024]. EnvVars.{key}对应的value的长度必须在0与1024之间。
400 InvalidInputMappingConfig Specified parameter InputMappingConfig is not valid. Its type must be object. InputMappingConfig必须是一个object。
400 InvalidLocale Specified parameter Locale is not valid. Locale参数取值不合法。
400 InvalidLock Specified parameter Lock is not valid. Its type must be boolean. Lock必须是一个布尔类型。
400 InvalidStdoutRedirectPath Specified parameter StdoutRedirectPath is not valid. Its type must be string. StdoutRedirectPath必须是一个string。
400 InvalidStdoutRedirectPath Specified parameter StdoutRedirectPath is not valid. Its length must be in [0, 1024]. StdoutRedirectPath的长度必须在0与1024之间。
400 InvalidStdoutRedirectPath Specified parameter StdoutRedirectPath is not valid. OSS path must start with ‘oss://‘, must end with ‘/‘ if it is a folder, and must not end with ‘/‘ if it is a file. StdoutRedirectPath必须是一个合法的OSS路径。
400 InvalidStderrRedirectPath Specified parameter StderrRedirectPath is not valid. Its type must be string. StderrRedirectPath必须是一个string。
400 InvalidStderrRedirectPath Specified parameter StderrRedirectPath is not valid. Its length must be in [0, 1024]. StderrRedirectPath的长度必须在0与1024之间。
400 InvalidStderrRedirectPath Specified parameter StderrRedirectPath is not valid. OSS path must start with ‘oss://‘, must end with ‘/‘ if it is a folder, and must not end with ‘/‘ if it is a file. StderrRedirectPath必须是一个合法的OSS路径。
400 InvalidInputMapping Specified parameter InputMapping is not valid. Its type must be object. InputMapping必须是一个object。
400 InvalidInputMapping Specified parameter InputMapping is not valid. Its size must be in [0, 16]. InputMapping的Key的个数必须在0与16之间。
400 InvalidInputMapping.{key} Specified parameter InputMapping.{key} is not valid. Its length must be in [1, 1024]. InputMapping.{key}的大小必须在1与1024之间。
400 InvalidInputMapping.{key} Specified parameter InputMapping.{key} is not valid. OSS path must start with ‘oss://‘, must end with ‘/‘ if it is a folder, and must not end with ‘/‘ if it is a file. InputMapping.{key}必须是一个合法的OSS路径。
400 InvalidInputMapping.{key}.value Specified parameter InputMapping.{key}.value is not valid. Its type must be string. InputMapping.{key}对应的Value必须是一个string。
400 InvalidInputMapping.{key}.value Specified parameter InputMapping.{key}.value is not valid. Its length must be in [0, 1024]. InputMapping.{key}对应的value的长度必须在0与1024之间。
400 InvalidInputMapping.{key}.value Specified parameter InputMapping.{key}.value is not valid. Local path must be an absolute path on linux, and an drive letter on windows. InputMapping.{key}对应的value必须是一个合法的本地路径。
400 InvalidOutputMapping Specified parameter OutputMapping is not valid. Its type must be object. OutputMapping必须是一个object。
400 InvalidOutputMapping Specified parameter OutputMapping is not valid. Its size must be in [0, 16]. OutputMapping的Key的个数必须在0与16之间。
400 InvalidOutputMapping.{key} Specified parameter OutputMapping.{key} is not valid. Its length must be in [1, 1024]. OutputMapping.{key}的大小必须在1与1024之间。
400 InvalidOutputMapping.{key} Specified parameter OutputMapping.{key} is not valid. Local path must be an absolute path. OutputMapping.{key}必须是一个合法的本地路径。
400 InvalidOutputMapping.{key}.value Specified parameter OutputMapping.{key}.value is not valid. Its type must be string. OutputMapping.{key}对应的Value必须是一个string
400 InvalidOutputMapping.{key}.value Specified parameter OutputMapping.{key}.value is not valid. Its length must be in [0, 1024]. OutputMapping.{key}对应的value的长度必须在0与1024之间。
400 InvalidOutputMapping.{key}.value Specified parameter OutputMapping.{key}.value is not valid. OSS path must start with ‘oss://‘, must end with ‘/‘ if it is a folder, and must not end with ‘/‘ if it is a file. OutputMapping.{key}对应的value的大小必须在1与1024之间。
400 InvalidLogMapping Specified parameter LogMapping is not valid. Its type must be object. LogMapping必须是一个object。
400 InvalidLogMapping Specified parameter LogMapping is not valid. Its size must be in [0, 16]. LogMapping的Key的个数必须在0与16之间。
400 InvalidLogMapping.{key} Specified parameter LogMapping.{key} is not valid. Its length must be in [1, 1024]. LogMapping.{key}的大小必须在1与1024之间。
400 InvalidLogMapping.{key} Specified parameter LogMapping.{key} is not valid. Local path must be an absolute path. LogMapping.{key}必须是一个合法的本地路径。
400 InvalidLogMapping.{key}.value Specified parameter LogMapping.{key}.value is not valid. Its type must be string. LogMapping.{key}对应的Value必须是一个string。
400 InvalidLogMapping.{key}.value Specified parameter LogMapping.{key}.value is not valid. Its length must be in [0, 1024]. LogMapping.{key}对应的value的长度必须在0与1024之间。
400 InvalidLogMapping.{key}.value Specified parameter LogMapping.{key}.value is not valid. OSS path must start with ‘oss://‘, must end with ‘/‘ if it is a folder, and must not end with ‘/‘ if it is a file. LogMapping.{key}对应的value的大小必须在1与1024之间。
400 InvalidTimeout Specified parameter Timeout is not valid. Its type must be integer. Timeout必须是一个integer。
400 MissingInstanceCount InstanceCount is mandatory for this action. 缺少InstanceCount参数。
400 InvalidInstanceCount Specified parameter InstanceCount is not valid. Its type must be integer. InstanceCount必须是一个integer。
400 InvalidMaxRetryCount Specified parameter MaxRetryCount is not valid. Its type must be integer. MaxRetryCount必须是一个integer。
400 MissingClusterId ClusterId is mandatory for this action. 缺少ClusterId参数。
400 InvalidClusterId Specified parameter ClusterId is not valid. Its type must be string. ClusterId必须是一个string。
400 InvalidClusterId Specified parameter ClusterId is not valid. Its length must be in [1, 64]. ClusterId的长度必须在1与64之间。
400 InvalidClusterId Specified parameter ClusterId is not valid. It must only contain characters within [a-zA-Z0-9_-], and must not start with [0-9]. ClusterId中只能包括字母数字和_-,但不能以数字开头。
400 InvalidDependencies Specified parameter Dependencies is not valid. Its type must be object. Dependencies必须是一个object。
400 InvalidDependencies.{key}.value Specified parameter Dependencies.{key}.value is not valid. Its type must be array. Dependencies.{key}对应的Value必须是一个array。
400 Invalid{Parameter} Specified parameter {Parameter} is not valid. {Parameter}参数不合法。

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • 创建作业(DAG类型) - 批量计算

    创建作业(DAG类型) - 批量计算

  • 负载均衡 创建 IPv6 NAT64 负载均衡实

    负载均衡 创建 IPv6 NAT64 负载均衡实

  • 删除集群实例 - 批量计算

    删除集群实例 - 批量计算

  • 负载均衡 创建 IPv6 负载均衡实例 - 操

    负载均衡 创建 IPv6 负载均衡实例 - 操

腾讯云代理商
精彩导读
海外云服务器
热门资讯
腾讯云代理商