All Products
Search
Document Center

Batch Compute:CreateJob(App Job)

Last Updated:Apr 06, 2023

Description

Creates a job that uses the App.

Request method

POST /jobs

Request body

{
    "Name": string,
    "Description": string,
    "Type": "App",
    "App": {
        "AppName": string,
        "Inputs": {
            string: Any
        },
        "Outputs": {
            string: string
        },
        "Logging": {
            "StdoutPath": string,
            "StderrPath": string
        },
        "Config": {
            "ResourceType": string,
            "InstanceType": string,
            "InstanceCount": number,
            "MinDiskSize": number,
            "DiskType": string,
            "MaxRetryCount": number,
            "Timeout": number,
            "ReserveOnFail": boolean
        }
    }
}

Request parameters

Parameter

Parameter

Type

Required or not

Description

Name

string

Yes

Name of a job. The valid character set is [a-zA-Z0-9_-]. The length cannot exceed 100 characters, and the name cannot be empty.

Description

String

No

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

Type

String

Yes

Job type. For a job of the App type, this field must be set to App.

AppName

String

Yes

Application name. The valid character set is [a-zA-Z0-9_-:]. The length cannot exceed 1024 characters.Two formats are available for the App name, and are used to access a public App and your private App, respectively.For example, to access the public App “App1”, set appName to Public:App1. “Public” can be omitted, that is, the App name changes to “:App1”.If App1 is your private App, directly set appName to App1.

Inputs

map

Yes

Input parameters of the job.”Map” must be a value between 0 and 50.”Key” must be a parameter name defined in InputParameters of the App, and “Value” must be consistent with the type of the parameter in the App.

outputs

map

No

Output parameters of the job.”Map” must be a value between 0 and 50.”Key” must be a parameter name that is defined in OutputParameters of the App and LocalPath of which is not null, and “Value” must be an OSS path.Default value:{}

Logging

object(Logging)

No

Log configuration.

Config

object(Config)

No

Running configuration of the job.

Logging

Parameter

Type

Required or not

Description

StdoutPath

String

No

OSS directory to which the standard output is redirected. The length cannot exceed 1000 characters.Default value: null

StderrPath

String

No

OSS directory to which the standard error is redirected. The length cannot exceed 1000 characters.Default value: null

Config

Parameter

Type

Required or not

Description

ResourceType

String

No

Resource type. Options include OnDemand and Spot. The default value is the value defined in the App.

InstanceType

String

No

ECS instance type. The default value is the value defined in the App.

InstanceCount

Number

No

Number of concurrently executed instances. The default value is the value defined in the App.

MinDiskSize

Number

No

Minimum disk size (GB). The default value is the value defined in the App.

DiskType

String

No

Disk type. The default value is the value defined in the App.

MaxRetryCount

Number

No

Maximum number of retries after an instance fails. The default value is the value defined in the App.

Timeout

number

No

Timeout of an instance, in seconds. The default value is the value defined in the App.

ReserveOnFail

Number

No

Whether to reserve the VM for further troubleshooting after a job fails. The default value is false.

Response

Response status code

Note

201

Response body

{
    "Id": string
}

Response parameters

Attribute

Type

Description

Id

String

Resource ID

Examples

Request

POST /jobs
{
    "Name": "job_name",
    "Description": "job description",
    "Type": "App",
    "App": {
        "AppName": "myapp",
        "Inputs": {
            "inputFile": "oss://bucket/a"
        },
        "Outputs": {
            "outputFile": "oss://bucket/b"
        },
        "Config": {
            "InstanceType": "ecs.s3.large"
        },
        "Logging": {
            "StdoutPath": "oss://bucket/logging/",
            "StderrPath": "oss://bucket/logging/"
        }
    }
}

Response

HTTP/1.1 201 Created
{
    "Id": "job-0000123"
}