All Products
Search
Document Center

Elastic High Performance Computing:CreateJob

Last Updated:May 22, 2025

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

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
ehpc:CreateJobcreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClusterIdstringYes

The cluster ID.

You can call the ListClusters operation to query the cluster ID.

ehpc-hz-FYUr32****
JobNamestringNo

The job name.

TestJob
JobSpecobjectNo

The job configurations.

CommandLinestringYes

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
RunasUserstringNo

The cluster-side user as which you want to submit the job.

testuser
RunasUserPasswordstringNo

The password of the user specified by the RunasUser parameter.

xxx
PrioritystringNo

The job priority.

1
StdoutPathstringNo

The path of the standard output file of the job. You need to specify the full path.

/home/xxx/job.out
StderrPathstringNo

The path of the standard error output file of the job. You need to specify the full path.

/home/xxx/job.err
JobQueuestringNo

The queue to which the job belongs.

comp
ArrayRequeststringNo

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
VariablesstringNo

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"}]
PostCmdLinestringNo

The post-processing command of the job.

/bin/sleep 10
WallTimestringNo

The maximum duration for which the job can be run. Format: hour: minute: second. For example, 01:00:00 indicates 1 hour.

360:48:50
ResourcesobjectNo

The resource configurations of the job.

NodesintegerNo

The number of compute nodes to be allocated to the job.

2
CoresintegerNo

The number of vCPUs to be allocated to each compute node.

2
MemorystringNo

The memory size to be allocated to each compute node. The memory size is in string format. Unit: MB or GB.

4gb
GpusintegerNo

The number of GPUs to be allocated to each compute node.

1

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

A0A38A38-1565-555E-B597-E48A2E******
JobIdstring

The job ID.

Submitted batch job 10\n
Successstring

Indicates whether the request was successful.

true

Examples

Sample success responses

JSONformat

{
  "RequestId": "A0A38A38-1565-555E-B597-E48A2E******",
  "JobId": "Submitted batch job 10\\n",
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidParamsThe specified parameter %s is invalid.The specified parameter %s is invalid.
403InvalidClusterStatusThe operation failed due to invalid cluster status.The cluster status does not support the operation.
404ClusterNotFoundThe specified cluster does not exist.The specified instance does not exist.
406EcsErrorAn error occurred while calling the ECS API operation.ECS API call error. %s
406AgentErrorThe agent service request failed: %sOperation unsuccessful: %s
406AgentError.Job.SubmitFailureFailed to submit jobs: %sFailed to submit the jobs.
406AgentError.Job.DeleteFailureFailed to delete job: %sFailed to delete the job: {}
406AgentError.Job.InvalidContainerTypeUnsupported container type: %s.The container type is not supported: %s.
406AgentError.Job.ListFailureFailed to list jobs: %s.Failed to obtain the job list: %s
406AgentError.Job.RerunFailureFailed to run the job again: %s.Failed to run the job again: %s
406AgentError.Job.StopFailureFailed to stop jobs: %s.Failed to stop the job: %s
503ServiceUnavailableThe request has failed due to a temporary failure of the serverThe 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 timeSummary of changesOperation
No change history