全部产品
Search
文档中心

批量计算:创建App

更新时间:Apr 12, 2018

描述

创建一个app资源(CreateApp)。

请求语法

POST /apps

  1. {
  2. "Name": string,
  3. "Description": string,
  4. "InputParameters": {
  5. string: {
  6. "Description": string,
  7. "Type": string,
  8. "Default": Any,
  9. "LocalPath": string
  10. },
  11. ...
  12. },
  13. "OutputParameters": {
  14. string: {
  15. "Description": string,
  16. "Type": string,
  17. "LocalPath": string
  18. },
  19. ...
  20. },
  21. // begin union
  22. // only one of the following can be specified:
  23. "Docker": {
  24. "Image": string,
  25. "RegistryOSSPath": string
  26. },
  27. "VM": {
  28. "ECSImageId": string
  29. },
  30. // end union
  31. "CommandLine": string,
  32. "EnvVars": {
  33. string: string,
  34. ...
  35. },
  36. "Daemonize": boolean,
  37. "Config": {
  38. "ResourceType": {
  39. "Description": string,
  40. "Default": string,
  41. "Overwritable": boolean
  42. },
  43. "InstanceType": {
  44. "Description": string,
  45. "Default": string,
  46. "Overwritable": boolean
  47. },
  48. "InstanceCount": {
  49. "Description": string,
  50. "Default": number,
  51. "Overwritable": boolean
  52. },
  53. "MinDiskSize": {
  54. "Description": string,
  55. "Default": number,
  56. "Overwritable": boolean
  57. },
  58. "DiskType": {
  59. "Description": string,
  60. "Default": string,
  61. "Overwritable": boolean
  62. },
  63. "MaxRetryCount": {
  64. "Description": string,
  65. "Default": number,
  66. "Overwritable": boolean
  67. },
  68. "Timeout": {
  69. "Description": string,
  70. "Default": number,
  71. "Overwritable": boolean
  72. }
  73. }
  74. }

请求参数

参数

参数名称 类型 必选 描述
Name string 应用名称。允许的字符集为[a-zA-Z0-9_-],长度不能大于64,不能为空
Description string 应用的详细描述。长度不能大于1000。默认值:空
InputParameters map<string, object(InputParameter)> 该应用的输入参数列表。Map大小不能大于50,不能小于0。对于Key,允许的字符集为[a-zA-Z0-9_-],长度不能大于100。默认值:{}
OutputParameters map<string, object(OutputParameter)> 该应用的输出参数列表。Map大小不能大于50,不能小于0。对于Key,允许的字符集为[a-zA-Z0-9_-],长度不能大于100。默认值:{}
Docker object(Docker) Docker镜像有关配置
VM object(VM) ECS虚拟机相关配置
CommandLine string 执行应用时的命令行。长度不能大于1000
EnvVars map<string, string> 环境变量。Map大小不能大于50,不能小于0。对于Key,允许的字符集为[a-zA-Z0-9_-],长度不能大于100。对于Value,长度不能大于1000。默认值:{}
Daemonize boolean 应用在执行时,是否每次都要重新启动。默认值:False
Config object(Config) 提交作业时的运行时参数

InputParameter

参数名称 类型 必选 描述
Description string 参数描述。长度不能大于1000。默认值:空
Type string 参数类型。枚举类型,可选值为:String、Number。默认值:String
Default Any 参数默认值。类型必须与Type指定的类型相同。默认值:null
LocalPath string LocalPath不为空说明该参数是OSS上的一个文件或者目录。在计算分析时,系统会将该参数值指定的OSS文件或者目录映射为本地LocalPath指定的文件或者目录。仅支持使用UTF-8编码。如果是目录,则必须以/结尾。长度不能大于1000。默认值:空

OutputParameter

参数名称 类型 必选 描述
Description string 参数描述。长度不能大于1000。默认值:空
Type string 参数类型。枚举类型,可选值为:String、Number。默认值:String
LocalPath string LocalPath不为空说明该参数是OSS上的一个文件或者目录。在计算分析时,系统会将本地LocalPath指定的文件或者目录映射为该参数值指定的OSS文件或者目录。仅支持使用UTF-8编码。如果是目录,则必须以/结尾。长度不能大于1000。默认值:空

Docker

参数名称 类型 必选 描述
Image string Docker镜像。长度不能大于1000
RegistryOSSPath string docker registry storage在OSS上的根目录。长度不能大于1000。默认值:空

VM

参数名称 类型 必选 描述
ECSImageId string ECS镜像Id。允许的字符集为[a-zA-Z0-9_-],长度不能大于100

Config

参数名称 类型 必选 描述
ResourceType object(ResourceType) 资源类型
InstanceType object(InstanceType) 实例类型
InstanceCount object(InstanceCount) 实例数量
MinDiskSize object(MinDiskSize) 最小磁盘大小(GB)
DiskType object(DiskType) 磁盘类型
MaxRetryCount object(MaxRetryCount) 某个Instance失败后,最大重试次数
Timeout object(Timeout) Instance的运行时超时时间,单位为秒

ResourceType

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default string 参数默认值。枚举类型,可选值为:OnDemand、Spot。默认值:OnDemand
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

InstanceType

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default string 参数默认值。长度不能大于1000。默认值:空
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

InstanceCount

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default number 参数默认值。必须为整数,不能大于1000,不能小于0。默认值:1
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

MinDiskSize

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default number 参数默认值。必须为整数,不能大于500,不能小于40。默认值:40
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

DiskType

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default string 参数默认值。枚举类型,可选值为:cloud、ephemeral、cloud_efficiency。默认值:cloud_efficiency
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

MaxRetryCount

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default number 参数默认值。必须为整数,不能大于1000,不能小于0。默认值:0
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

Timeout

参数名称 类型 必选 描述
Description string 给APP使用者的详细描述。长度不能大于1000。默认值:空
Default number 参数默认值。必须为整数,不能大于1000000000,不能小于0。默认值:86400
Overwritable boolean 用户使用该APP提交作业时,是否可以覆盖掉默认值。默认值:True

返回信息

成功

返回状态码(Response Status)

HTTP/1.1 201 Created

返回消息体(Response Body)

  1. {
  2. "Name": string
  3. }

响应参数

参数名称 类型 描述
Name string 资源Name

示例

请求:

  1. POST /apps HTTP/1.1
  2. {
  3. "Name": "copy",
  4. "Description": "Copy input file to output file",
  5. "Type": "Docker",
  6. "InputParameters": {
  7. "inputFile": {
  8. "Type": "String",
  9. "LocalPath": "/tmp/infile"
  10. }
  11. },
  12. "OutputParameters": {
  13. "outputFile": {
  14. "Type": "String",
  15. "LocalPath": "/tmp/outfile"
  16. }
  17. },
  18. "Docker": {
  19. "Image": "ubuntu:14.04",
  20. "RegistryOSSPath": "oss://bucket/registry"
  21. },
  22. "CommandLine": "cp ${inputFile} ${outputFile} "
  23. }

响应:

  1. HTTP/1.1 201 Created
  2. {
  3. "Name": "copy"
  4. }