All Products
Search
Document Center

CreateApp

Last Updated: May 11, 2018

Description

Creates an App.

Request

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

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(InputParameter)> 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(OutputParameter)> 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(Docker) No Configuration related to the Docker image
VM object(VM) 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(Config) 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(ResourceType) No Resource type
InstanceType object(InstanceType) No Instance type
InstanceCount object(InstanceCount) No Number of instances
MinDiskSize object(MinDiskSize) No Minimum disk size (GB)
DiskType object(DiskType) No Disk type
MaxRetryCount object(MaxRetryCount) No Maximum number of retries in case an instance fails
Timeout object(Timeout) 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

HTTP/1.1 201 Created

Response body

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

Response parameters

Attribute Type Description
Name String Resource name

Examples

Request:

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

Response:

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