All Products
Search
Document Center

CreateJob

Last Updated: May 14, 2018

Description

Creates a job that uses the App.

Request method

  1. POST /jobs

Request body

  1. {
  2. "Name": string,
  3. "Description": string,
  4. "Type": "App",
  5. "App": {
  6. "AppName": string,
  7. "Inputs": {
  8. string: Any
  9. },
  10. "Outputs": {
  11. string: string
  12. },
  13. "Logging": {
  14. "StdoutPath": string,
  15. "StderrPath": string
  16. },
  17. "Config": {
  18. "ResourceType": string,
  19. "InstanceType": string,
  20. "InstanceCount": number,
  21. "MinDiskSize": number,
  22. "DiskType": string,
  23. "MaxRetryCount": number,
  24. "Timeout": number,
  25. "ReserveOnFail": boolean
  26. }
  27. }
  28. }

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

201

Response body

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

Response parameters

Attribute Type Description
Id String Resource ID

Examples

Request

  1. POST /jobs
  2. {
  3. "Name": "job_name",
  4. "Description": "job description",
  5. "Type": "App",
  6. "App": {
  7. "AppName": "myapp",
  8. "Inputs": {
  9. "inputFile": "oss://bucket/a"
  10. },
  11. "Outputs": {
  12. "outputFile": "oss://bucket/b"
  13. },
  14. "Config": {
  15. "InstanceType": "ecs.s3.large"
  16. },
  17. "Logging": {
  18. "StdoutPath": "oss://bucket/logging/",
  19. "StderrPath": "oss://bucket/logging/"
  20. }
  21. }
  22. }

Response

  1. HTTP/1.1 201 Created
  2. {
  3. "Id": "job-0000123"
  4. }