描述
创建一个app资源(CreateApp
)。
请求语法
POST /apps
{
"Name": string,
"Description": string,
"InputParameters": {
string: {
"Description": string,
"Type": string,
"Default": Any,
"LocalPath": string
},
...
},
"OutputParameters": {
string: {
"Description": string,
"Type": string,
"LocalPath": string
},
...
},
// begin union
// only one of the following can be specified:
"Docker": {
"Image": string,
"RegistryOSSPath": string
},
"VM": {
"ECSImageId": string
},
// end union
"CommandLine": string,
"EnvVars": {
string: string,
...
},
"Daemonize": boolean,
"Config": {
"ResourceType": {
"Description": string,
"Default": string,
"Overwritable": boolean
},
"InstanceType": {
"Description": string,
"Default": string,
"Overwritable": boolean
},
"InstanceCount": {
"Description": string,
"Default": number,
"Overwritable": boolean
},
"MinDiskSize": {
"Description": string,
"Default": number,
"Overwritable": boolean
},
"DiskType": {
"Description": string,
"Default": string,
"Overwritable": boolean
},
"MaxRetryCount": {
"Description": string,
"Default": number,
"Overwritable": boolean
},
"Timeout": {
"Description": string,
"Default": number,
"Overwritable": boolean
}
}
}
请求参数
参数
参数名称 | 类型 | 必选 | 描述 |
---|---|---|---|
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)
{
"Name": string
}
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
Name | string | 资源Name |
示例
请求:
POST /apps HTTP/1.1
{
"Name": "copy",
"Description": "Copy input file to output file",
"Type": "Docker",
"InputParameters": {
"inputFile": {
"Type": "String",
"LocalPath": "/tmp/infile"
}
},
"OutputParameters": {
"outputFile": {
"Type": "String",
"LocalPath": "/tmp/outfile"
}
},
"Docker": {
"Image": "ubuntu:14.04",
"RegistryOSSPath": "oss://bucket/registry"
},
"CommandLine": "cp ${inputFile} ${outputFile} "
}
响应:
HTTP/1.1 201 Created
{
"Name": "copy"
}