CreateJob
Creates a job to run in a cluster. You can specify configurations such as the datasource config, code source config, startup commands, and compute resource for each node where the job runs.
Operation description
Make sure that you fully understand the billing methods and pricing of PAI-DLC before you call this operation.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
paidlc:CreateJob |
create |
*All Resource
|
None | None |
Request syntax
POST /api/v1/jobs HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body parameters. |
|
| DisplayName |
string |
Yes |
The name of the job. The naming conventions are as follows:
|
tf-mnist-test |
| JobType |
string |
Yes |
The type of the job. This parameter is case-sensitive. Valid values:
Valid values:
|
TFJob |
| JobSpecs |
array |
Yes |
JobSpecs describes various configurations for job execution, such as the image address, startup command, node resource declaration, and number of replicas. A DLC job consists of different types of nodes. Nodes of the same type share the exact same configuration, which is called a JobSpec. JobSpecs describes the configurations for all types of nodes and is an array of JobSpec objects. |
|
| JobSpec |
No |
The runtime configuration of the job. |
||
| UserCommand |
string |
Yes |
The startup command for all nodes of the job. |
python /root/code/mnist.py |
| DataSources |
array<object> |
No |
The list of data sources used for job execution. |
|
|
object |
No |
The list of all data sources used by this job. The data sources are mounted to the local directories of the containers where each node resides based on the configurations in the data sources. The local directory is specified by the MountPath parameter in the data source configuration. The processes in the startup command of the job directly access the distributed file system represented by each data source by using the MountPath. |
||
| DataSourceId |
string |
No |
The ID of the data source. For more information about how to view the data source ID, see ListDatasets. |
d-cn9dl******* |
| MountPath |
string |
No |
The path to be mounted for this job. This parameter is optional. By default, the mount path in the data source is used. |
/root/data |
| Uri |
string |
No |
The path of the data source. |
oss://bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/ |
| Options |
string |
No |
The custom dataset mount property. Currently, only OSS is supported. |
{ "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" } |
| DataSourceVersion |
string |
No |
The dataset version. |
v1 |
| MountAccess |
string |
No |
The permissions when the dataset is mounted. Valid values:
|
RO |
| EnableCache |
boolean |
No |
Specifies whether to enable the cache service for this data source. This parameter takes effect only when the cluster supports it and a resource group is configured. |
|
| AccessPointId |
string |
No |
The ID of the access point. Currently, only access points of CPFS for AI are supported. |
ap-1st8hg94cgxslmdba |
| RoleChain |
string |
No |
The role chain, which is a JSON-formatted string. Example: [{"roleType":"service","roleArn":"acs:ram::cloud product resource account UID:role/xxxtodlcrole","assumeRoleFor":"cloud product resource account UID"},{"roleType":"user","roleArn":"acs:ram::cloud product service account UID:role/roletoassumecustomerrole"},{"roleType":"service","roleArn":"acs:ram::end user UID:role/use-bmcpfs-access-ap-role","assumeRoleFor":"end user UID"}] |
[{"roleType":"service","roleArn":"acs:ram::cloud product resource account UID:role/xxxtodlcrole","assumeRoleFor":"cloud product resource account UID"},{"roleType":"user","roleArn":"acs:ram::cloud product service account UID:role/roletoassumecustomerrole"},{"roleType":"service","roleArn":"acs:ram::end user UID:role/use-bmcpfs-access-ap-role","assumeRoleFor":"end user UID"}] |
| RoleArn |
string |
No |
The ARN of the data source role. This parameter is required when OSS and CPFS access point authentication is enabled. |
acs:ram::1872xxxxxxxxx:role/account-pai-prod |
| UserVpc |
object |
No |
The user VPC configuration. |
|
| VpcId |
string |
No |
The ID of the user VPC. |
vpc-abcdef**** |
| SwitchId |
string |
No |
The ID of the user vSwitch. This parameter is optional.
|
vs-abcdef**** |
| SecurityGroupId |
string |
No |
The ID of the user security group. |
sg-abcdef**** |
| ExtendedCIDRs |
array |
No |
The extended CIDR blocks.
|
|
|
string |
No |
The extended CIDR block. |
192.168.0.1/24 |
|
| DefaultRoute |
string |
No |
The default routing. Valid values:
|
eth0 |
| CodeSource |
object |
No |
The code source used by this job. Before the nodes of the job start, DLC automatically downloads the code configured in the code source and mounts it to the local directory of the container. |
|
| CodeSourceId |
string |
No |
The ID of the code source. For more information about how to obtain the code source ID, see ListCodeSources. |
code-20210111103721-xxxxxxx |
| Branch |
string |
No |
The branch of the code repository referenced when this job runs. This parameter is optional. By default, the branch configured in the code source is used. |
master |
| Commit |
string |
No |
The commit ID of the code to be downloaded for this job. This parameter is optional. By default, the commit ID configured in the code source is used. |
44da109b5****** |
| MountPath |
string |
No |
The path to be mounted for this job. This parameter is optional. By default, the mount path configured in the code source is used. |
/root/data |
| IsSharedMountPath |
boolean |
No |
Specifies whether the MountPath configured in access code source is a shared cloud storage path. If this parameter is set to true, the system enables code clone optimization. In multi-node job scenarios, the clone operation is performed on only one node, and other nodes can directly access access code through the shared cloud storage path. |
|
| ThirdpartyLibs |
array |
No |
The list of Python third-party libraries to be installed. |
|
|
string |
No |
Specifies a third-party Python library and the corresponding version requirement. Example: |
numpy==1.16.1 |
|
| ThirdpartyLibDir |
string |
No |
The name of the folder where the Python third-party library file (requirements.txt) is located. Before each node runs the specified UserCommand, PAI-DLC retrieves the requirements.txt file from the specified folder and runs the |
/root/code/ |
| Envs |
object |
No |
The environment variable configuration. |
|
|
string |
No |
An environment variable in the Important Environment variables must comply with POSIX standards. |
ENABLE_DEBUG_MODE |
|
| JobMaxRunningTimeMinutes |
integer |
No |
The maximum running duration of the job, in minutes. |
1024 |
| WorkspaceId |
string |
No |
The ID of the workspace. For more information about how to obtain the workspace ID, see ListWorkspaces. |
ws-20210126170216-xxxxxxx |
| ResourceId |
string |
No |
The ID of the resource group. This parameter is optional.
|
rs-xxx |
| Priority |
integer |
No |
The priority of the job. This parameter is optional. Default value: 1. Valid values: 1 to 9.
|
8 |
| Settings | JobSettings |
No |
The additional parameter settings for the job. |
|
| ElasticSpec | JobElasticSpec |
No |
This parameter is not supported. Ignore this parameter. |
|
| DebuggerConfigContent |
string |
No |
This parameter is not supported. Ignore this parameter. |
“” |
| Options |
string |
No |
The additional configuration for this node. You can use this parameter to adjust the behavior of mounted data sources. For example, if the node mounts an OSS data source, you can set this parameter to |
key1=value1,key2=value2 |
| SuccessPolicy |
string |
No |
The success policy for distributed multi-node jobs. Currently, only multi-node TensorFlow jobs are supported. Valid values:
|
AllWorkers |
| CredentialConfig | CredentialConfig |
No |
The access credential configuration. |
|
| Accessibility |
string |
No |
The visibility of the job. Valid values:
|
PRIVATE |
| TemplateId |
string |
No |
The ID of the task template. |
tplabc1234567 |
| TemplateVersion |
integer |
No |
The version of the task template. |
1 |
| Description |
string |
No |
The description of the task. |
This is a training job |
| SchedulingStrategy |
string |
No |
The scheduling strategy. Valid values:
|
Auto |
| DryRun |
boolean |
No |
Specifies whether to enable dry run mode. |
|
| CustomEnvs |
array<object> |
No |
The list of custom environment variables. |
|
|
object |
No |
|||
| Key |
string |
No |
The name of the environment variable. |
PUB |
| Value |
string |
No |
The value of the environment variable. |
keep |
| Visible |
string |
No |
The visibility of the environment variable. A value of public indicates that the variable is public, and a value of private indicates that the variable is private. |
public |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The JSON-formatted string. |
||
| JobId |
string |
The ID of the job created by this request. |
dlc7******* |
| RequestId |
string |
The ID of the request, which is used for diagnostics and troubleshooting. |
473469C7-AA6F-4DC5-B3DB-xxxxxxx |
Examples
Success response
JSON format
{
"JobId": "dlc7*******",
"RequestId": "473469C7-AA6F-4DC5-B3DB-xxxxxxx"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.