Creates a job for a cluster.
Operation description
Before you call this operation, make sure that you understand the billing and pricing of E-HPC.
Debugging
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 Resourcesis 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.
| Operation | Access level | Resource type | Condition key | Associated operation |
|---|---|---|---|---|
| ehpc:CreateJob | create | *All Resources * |
| none |
Request parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| ClusterId | string | Yes | The cluster ID. You can call the ListClusters operation to query the cluster ID. | ehpc-hz-FYUr32**** |
| JobName | string | No | The job name. | TestJob |
| JobSpec | object | No | The job configurations. | |
| CommandLine | string | Yes | The command or script that is used to run the job. If you want to use a command, you must specify the full path of the command, for example, /bin/ping. If you want to use a script, you must make sure that you have the execution permissions on it. By default, the user root directory ~/ is used as the default script path on the cluster side. If your script is not in that directory, you must specify the full path in this parameter, such as /home/xxx/job.sh Note that in this mode, if requirements on resources such as CPU and memory are specified in the script, the job will be run based on the resource requirements specified in the script. In this case, do not specify resource requirements in the Resource parameter. Otherwise, the job may fail to run. If you want to run the job directly by using the CLI, you must specify the absolute path of the command and add two hyphens and a space (-- ) before the path, such as -- /bin/ping -c 10 localhost. | /home/xxx/test.job |
| RunasUser | string | No | The cluster-side user as which you want to submit the job. | testuser |
| RunasUserPassword | string | No | The password of the user specified by the RunasUser parameter. | xxx |
| Priority | string | No | The job priority. | 1 |
| StdoutPath | string | No | The path of the standard output file of the job. You need to specify the full path. | /home/xxx/job.out |
| StderrPath | string | No | The path of the standard error output file of the job. You need to specify the full path. | /home/xxx/job.err |
| JobQueue | string | No | The queue to which the job belongs. | comp |
| ArrayRequest | string | No | The jobs in the queue. Format: X-Y:Z. X is the minimum index value. Y is the maximum index value. Z is the step size. For example, 2-7:2 indicates that three jobs need to be run and their index values are 2, 4, and 6. | 1-5:2 |
| Variables | string | No | The environment variables of the job. The value is a string in the JSON array format. Each array member is a JSON object that contains two members: Name and Value. Name indicates the name of the environment variable, and Value indicates the value of the environment variable. | [{"Name":"x", "Value":"y"}] |
| PostCmdLine | string | No | The post-processing command of the job. | /bin/sleep 10 |
| WallTime | string | No | The maximum duration for which the job can be run. Format: | 360:48:50 |
| Resources | object | No | The resource configurations of the job. | |
| Nodes | integer | No | The number of compute nodes to be allocated to the job. | 2 |
| Cores | integer | No | The number of vCPUs to be allocated to each compute node. | 2 |
| Memory | string | No | The memory size to be allocated to each compute node. The memory size is in string format. Unit: MB or GB. | 4gb |
| Gpus | integer | No | The number of GPUs to be allocated to each compute node. | 1 |
Response parameters
Examples
Sample success responses
JSONformat
{
"RequestId": "A0A38A38-1565-555E-B597-E48A2E******",
"JobId": "Submitted batch job 10\\n",
"Success": true
}Error codes
| HTTP status code | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidParams | The specified parameter %s is invalid. | The specified parameter %s is invalid. |
| 403 | InvalidClusterStatus | The operation failed due to invalid cluster status. | The cluster status does not support the operation. |
| 404 | ClusterNotFound | The specified cluster does not exist. | The specified instance does not exist. |
| 406 | EcsError | An error occurred while calling the ECS API operation. | ECS API call error. %s |
| 406 | AgentError | The agent service request failed: %s | Operation unsuccessful: %s |
| 406 | AgentError.Job.SubmitFailure | Failed to submit jobs: %s | Failed to submit the jobs. |
| 406 | AgentError.Job.DeleteFailure | Failed to delete job: %s | Failed to delete the job: {} |
| 406 | AgentError.Job.InvalidContainerType | Unsupported container type: %s. | The container type is not supported: %s. |
| 406 | AgentError.Job.ListFailure | Failed to list jobs: %s. | Failed to obtain the job list: %s |
| 406 | AgentError.Job.RerunFailure | Failed to run the job again: %s. | Failed to run the job again: %s |
| 406 | AgentError.Job.StopFailure | Failed to stop jobs: %s. | Failed to stop the job: %s |
| 503 | ServiceUnavailable | The request has failed due to a temporary failure of the server | The request has failed due to a temporary failure of the server. |
For a list of error codes, visit the Service error codes.
Change history
| Change time | Summary of changes | Operation |
|---|
