All Products
Search
Document Center

Batch Compute:createApp

Last Updated:Dec 13, 2022

Method description

Creates an App.

Call method

CreateAppResponse createApp(AppDescription appDescription) throws ClientException;

CreateAppResponse createApp(CreateAppRequest req) throws ClientException;

CreateAppResponse createApp(AppDescription appDescription, String idempotentToken) throws ClientException;

Parameter description

Parameter

Type

Required

Description

appDescription

AppDescription

Yes

Description of the created App

The package names of the following classes are all com.aliyuncs.batchcompute.pojo.v20151111.

Attributes of AppDescription

The getter and setter methods are available to all attributes.

Attribute

Type

Required

Description

name

String

Yes

App name

description

String

No

Brief description

inputParameters

Map

No

Input parameter description

outputParameters

Map

No

Output parameter description

docker

AppDescription.Docker

No

Use the Docker configuration. You can select one of Docker and VM for configuration

vm

AppDescription.VM

No

Use the ECS VM-related configurations.You can select one of Docker and VM for configuration

commandLine

String

Yes

Command line for running the App.

envVars

Map

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

AppDescription.Config

No

Runtime parameters when the job is submitted

Attributes of AppDescription.InputParameterValue

Parameter

Type

Required

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

defaultValue

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

Attributes of AppDescription.OutputParameterValue

Parameter

Type

Required

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

Attributes of AppDescription.Docker

Parameter

Type

Required

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

Attributes of AppDescription.VM

Parameter

Type

Required

Description

ECSImageId

String

Yes

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

Attributes of AppDescription.Config

Parameter

Type

Required

Description

resourceType

App.ConfigValue

No

Type of the resource

instanceType

App.ConfigValue

No

Type of the instance

instanceCount

App.ConfigValueInteger

No

Number of instances

minDiskSize

App.ConfigValue

No

Minimum size of the system disk (GB)

diskType

App.ConfigValue

No

Type of the system disk

maxRetryCount

App.ConfigValueInteger

No

Maximum number of retries after an instance fails

timeout

App.ConfigValueLong

No

Timeout of an instance, in seconds

Attributes of AppDescription.ConfigValue

Attribute

Type

Required

Description

description

String

No

Detailed description for the App users

defaultValue

string

No

Default value of the parameter

overwritable

Boolean

No

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

Attributes of AppDescription.ConfigValueInteger

Attribute

Type

Required

Description

description

String

No

Detailed description for the App users

defaultValue

int

No

Default value of the parameter

overwritable

Boolean

No

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

Attributes of AppDescription.ConfigValueLong

Parameter

Type

Required

Description

description

String

No

Detailed description for the App users

defaultValue

long

No

Default value of the parameter

overwritable

Boolean

No

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

Response description

  • If the App is successfully created, a CreateAppResponse instance is returned. You can use response.getAppName() to obtain the name of the created App.

Type

Description

CreateAppResponse

Obtains the name of the created App

  • The CreateAppResponse package name is com.aliyuncs.batchcompute.model.v20151111.

  • Other responses listed in the following are under this package.

  • If creation fails, a ClientException is thrown.

Sample code

try{
  CreateAppResponse response = client.createApp(appDescription);
  String appName = response.getAppName();
  //Creation succeeded

}catch(ClientException e){
  e.printStackTrace();
  //Creation failed
}