All Products
Search
Document Center

Batch Compute:CreateApp

Last Updated:Apr 11, 2023

Description

Creates an App.

Request

Note

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
        }
    }
}

Request parameters

Parameter

Name

Type

Required

Description

Name

String

Yes

Name of the App. The valid character set is [a-zA-Z0-9-]. It can contain up to 64 characters and cannot be null.

Description

String

No

Detailed description of the App.The length cannot exceed 1000 characters.Default value: null

InputParameters

map<string,object>

No

Input parameter list of the App.”Map” must be a value between 0 and 50.The valid character set of Key is [a-zA-Z0-9-], and the length of Key cannot exceed 100 characters.Default value:{}

OutputParameters

map <string, object>

No

Output parameter list of the App.”Map” must be a value between 0 and 50.The valid character set of Key is [a-zA-Z0-9-], and the length of Key cannot exceed 100 characters.Default value:{}

Docker

object

No

Configuration related to the Docker image

VM

object

No

Configuration related to the ECS instance

CommandLine

String

Yes

Command line for running the App.The length cannot exceed 1000 characters.

EnvVars

map <string, string>

No

Environmental variable.”Map” must be a value between 0 and 50.The valid character set of Key is [a-zA-Z0-9-], and the length of Key cannot exceed 100 characters.The length of Value cannot exceed 1000 characters.Default value:{}

Daemonize

boolean

No

Specifies whether to restart when the App is executed. The default value is False.

Config

object

No

Runtime parameters when the job is submitted

InputParameter

Parameter

Type

Required or not

Description

Description

String

No

Parameter description.The length cannot exceed 1000 characters.Default value: null

Type

String

No

Parameter type.Enumerated type. Optional values include String and Number.Default value: String

Default

Any

No

Default value of the parameter. The type must be the same as that specified by Type.Default value: null

LocalPath

String

No

If LocalPath is not null, this parameter specifies an OSS file or directory. During compute analysis, the system maps the OSS file or directory specified by this parameter to a file or directory specified by LocalPath.It supports only UTF-8 encoding.If localPath is a directory, it must end with a slash (/).The length cannot exceed 1000 characters.Default value: null

OutputParameter

Parameter

Type

Required or not

Description

Description

String

No

Parameter description.The length cannot exceed 1000 characters.Default value: null

Type

String

No

Parameter type.Enumerated type. Optional values include String and Number.Default value: String

LocalPath

String

No

If LocalPath is not null, this parameter specifies an OSS file or directory. During compute analysis, the system maps the file or directory specified by LocalPath to a file or directory specified by this parameter. It supports only UTF-8 encoding.If localPath is a directory, it must end with a slash (/).The length cannot exceed 1000 characters.Default value: null

Docker

Parameter

Type

Required or not

Description

Image

String

Yes

Docker image.The length cannot exceed 1000 characters.

RegistryOSSPath

String

No

Root directory of the Docker registry storage on the OSS instance.The length cannot exceed 1000 characters.Default value: null

VM

Parameter

Type

Required or not

Description

ECSImageId

String

Yes

ID of the ECS image.The valid character set is [a-zA-Z0-9_-]. The length cannot exceed 100 characters.

Config

Parameter

Type

Required or not

Description

ResourceType

object

No

Resource type

InstanceType

object

No

Instance type

InstanceCount

object

No

Number of instances

MinDiskSize

object

No

Minimum disk size (GB)

DiskType

object

No

Disk type

MaxRetryCount

object

No

Maximum number of retries in case an instance fails

Timeout

object

No

Timeout of an instance, in seconds

ResourceType

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

String

No

Default value of the parameter. It is of the enumerated type. The options are OnDemand and Spot. The default value is OnDemand.

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job. The default value is True.

InstanceType

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

String

No

Default value of the parameter. The length cannot exceed 1000 characters.Default value: null

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job.The default value is True.

InstanceCount

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

Number

No

Default value of the parameter. It must be an integer between 0 and 1000. The default value is 1.

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job.The default value is True.

MinDiskSize

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

Number

No

Default value of the parameter. It must be an integer between 40 and 500. The default value is 40.

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job.The default value is True.

DiskType

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

String

No

Default value of the parameter. It is of the enumerated type. The options are cloud, ephemeral, and cloud_efficiency. The default value is cloud_efficiency.

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job.The default value is True.

MaxRetryCount

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

Number

No

Default value of the parameter.It must be an integer between 0 and 1000. The default value is 0.

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job.The default value is True.

Timeout

Parameter

Type

Required or not

Description

Description

String

No

Detailed description for the App users.The length cannot exceed 1000 characters.Default value: null

Default

Number

No

Default value of the parameter. It must be an integer between 0 and 1,000,000,000. The default value is 86400.

Overwritable

Boolean

No

Specifies whether the default value is overwritten if this App is used to submit a job.The default value is True.

Response

Success

Response status code

Note

HTTP/1.1 201 Created

Response body

{
    "Name": string
}

Response parameters

Attribute

Type

Description

Name

String

Resource name

Examples

Request:

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} "
}

Response:

HTTP/1.1 201 Created
{
    "Name": "copy"
}