All Products
Search
Document Center

Platform For AI:CreateJob

Last Updated:Oct 22, 2025

Creates a job that runs in a cluster. You can configure the data source, code source, startup command, and computing resources of each node on which a job runs.

Operation description

Before you call this operation, make sure that you understand the billing methods and pricing of Deep Learning Containers (DLC) of Platform for AI (PAI).

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
paidlc:CreateJobcreate
*All Resources
*
    none
none

Request syntax

POST /api/v1/jobs HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
bodyobjectNo

The request parameters.

DisplayNamestringYes

The job name. The name must be in the following format:

  • The name must be 1 to 256 characters in length.
  • The name can contain digits, letters, underscores (_), periods (.), and hyphens (-).
tf-mnist-test
JobTypestringYes

The job type. The value is case-sensitive. The following job types are supported:

  • TFJob
  • PyTorchJob
  • MPIJob
  • XGBoostJob
  • OneFlowJob
  • ElasticBatchJob
  • SlurmJob
  • RayJob

Valid values and corresponding frameworks:

  • OneFlowJob: OneFlow.
  • PyTorchJob: PyTorch.
  • SlurmJob: Slurm.
  • XGBoostJob: XGBoost.
  • ElasticBatchJob: ElasticBatch.
  • MPIJob: MPIJob.
  • TFJob: Tensorflow.
  • RayJob: Ray.
TFJob
JobSpecsarrayYes

JobSpecs describes the configurations for job running, such as the image address, startup command, node resource declaration, and number of replicas.

A DLC job consists of different types of nodes. If nodes of the same type have exactly the same configuration, the configuration is called JobSpec. JobSpecs specifies the configurations of all types of nodes. The value is of the array type.

JobSpecNo

The runtime configurations of the job.

UserCommandstringYes

The startup command for all nodes of the job.

python /root/code/mnist.py
DataSourcesarray<object>No

The data sources for job running.

objectNo

All data sources of the job. The data source is mounted to the local path of the container in which each node resides based on the data source configuration. The local path is specified by the MountPath parameter in the data source configuration.

The process in the startup command of the job directly accesses the distributed file system that resides in the path specified by the MountPath parameter. Each data source is a distributed file system.

DataSourceIdstringNo

The data source ID.

d-cn9dl*******
MountPathstringNo

The path to which the job is mounted. By default, the mount path in the data source configuration is used. This parameter is optional.

/root/data
UristringNo

The data source path.

oss://bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/
OptionsstringNo

The mount attribute of the custom dataset. Set the value to OSS.

{ "fs.oss.download.thread.concurrency": "10", "fs.oss.upload.thread.concurrency": "10", "fs.jindo.args": "-oattr_timeout=3 -oentry_timeout=0 -onegative_timeout=0 -oauto_cache -ono_symlink" }
CodeSourceobjectNo

The code source of the job. Before the node of the job runs, DLC automatically downloads the configured code from the code source and mounts the code to the local path of the container.

CodeSourceIdstringNo

The ID of the code source.

code-20210111103721-xxxxxxx
BranchstringNo

The branch of the referenced code repository. By default, the branch configured in the code source is used. This parameter is optional.

master
CommitstringNo

The commit ID of the code to be downloaded. By default, the commit ID configured in the code source is used. This parameter is optional.

44da109b5******
MountPathstringNo

The path to which the job is mounted. By default, the mount path configured in the data source is used. This parameter is optional.

/root/data
UserVpcobjectNo

The VPC settings.

VpcIdstringNo

The VPC ID.

vpc-abcdef****
SwitchIdstringNo

The vSwitch ID. This parameter is optional.

  • If you leave this parameter empty, the system automatically selects a vSwitch based on the inventory status.
  • You can also specify a vSwitch ID.
vs-abcdef****
SecurityGroupIdstringNo

The ID of the security group.

sg-abcdef****
ExtendedCIDRsarrayNo

The extended CIDR block.

  • If you leave the SwitchId and ExtendedCIDRs parameters empty, the system automatically obtains all CIDR blocks in a VPC.
  • If you configure the SwitchId and ExtendedCIDRs parameters, we recommend that you specify all CIDR blocks in a VPC.
stringNo

The extended CIDR block.

192.168.0.1/24
DefaultRoutestringNo

The default route. Default value: false. Valid values:

eth0
ThirdpartyLibsarrayNo

The third-party Python libraries to be installed.

stringNo

The third-party Python library and its version. Example: numpy==1.16.1.

numpy==1.16.1
ThirdpartyLibDirstringNo

The folder in which the third-party Python library file requirements.txt is stored. Before the startup command specified by the UserCommand parameter is run on each node, DLC fetches the requirements.txt file from the folder and runs pip install -r to install the required package and library.

/root/code/
EnvsobjectNo

The environment variables.

stringNo

The environment variable in the Key=Value format.

ENABLE_DEBUG_MODE
JobMaxRunningTimeMinuteslongNo

The maximum running duration of the job. Unit: minutes.

1024
WorkspaceIdstringNo

The workspace ID.

ws-20210126170216-xxxxxxx
ResourceIdstringNo

The ID of the resource group. This parameter is optional.

  • If you leave this parameter empty, the job is submitted to a public resource group.
  • If a resource quota is bound to the current workspace, you can specify the resource quota ID. For more information about how to query the resource quota ID, see Manage resource quotas.
rs-xxx
PriorityintegerNo

The priority of the job. Default value: 1. Valid values: 1 to 9.

  • 1 is the lowest priority.
  • 9: the highest priority.
8
SettingsJobSettingsNo

The additional parameter configurations of the job.

ElasticSpecJobElasticSpecNo

This parameter is not supported.

DebuggerConfigContentstringNo

This parameter is not supported.

“”
OptionsstringNo

The additional configuration of the job. You can use this parameter to adjust the behavior of the attached data source. For example, if the attached data source of the job is of the OSS type, you can use this parameter to add the following configurations to override the default parameters of JindoFS: fs.oss.download.thread.concurrency=4,fs.oss.download.queue.size=16.

key1=value1,key2=value2
SuccessPolicystringNo

The policy that is used to check whether a distributed multi-node job is successful. Only TensorFlow distributed multi-node jobs are supported.

  • ChiefWorker: If you use this policy, the job is considered successful when the pod on the chief node completes operations.
  • AllWorkers (default): If you use this policy, the job is considered successful when all worker nodes complete operations.
AllWorkers
CredentialConfigCredentialConfigNo

The access credential configuration.

AccessibilitystringNo

The job visibility. Valid values:

  • PUBLIC: The job is visible to all members in the workspace.
  • PRIVATE: The job is visible only to you and the administrator of the workspace.
PRIVATE

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

JobIdstring

The job ID.

dlc7*******
RequestIdstring

The request ID used to troubleshoot issues.

473469C7-AA6F-4DC5-B3DB-xxxxxxx

Examples

Sample success responses

JSONformat

{
  "JobId": "dlc7*******",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-xxxxxxx"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-18The internal configuration of the API is changed, but the call is not affectedView Change Details
2024-08-09The internal configuration of the API is changed, but the call is not affectedView Change Details
2024-07-05The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-12-08The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-09-11The internal configuration of the API is changed, but the call is not affectedView Change Details