CreateJob

Updated at:

Creates an E-HPC Instant job.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ehpc:CreateJob

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

JobName

string

Yes

The job name. The name must be 2 to 64 characters in length and can contain letters, Chinese characters, and digits. It can also contain hyphens (-) and underscores (_).

testjob

JobDescription

string

No

The job description.

Demo

Tasks

array<object>

Yes

The list of tasks. Only one task is supported.

array<object>

No

The task details.

ExecutorPolicy

object

No

The task execution policy.

ArraySpec

object

No

The array job details. The index values of sub-jobs are passed to the runtime environment through environment variables and can be referenced by your business programs. The environment variables include:

  • EHPC_JOB_NAME: the job name, which corresponds to the JobName parameter.

  • EHPC_JOB_ID: the job ID.

  • EHPC_TASK_NAME: the task name, which corresponds to the TaskName parameter.

  • EHPC_EXECUTOR_ID: the executor ID.

  • EHPC_ARRAY_TASK_ID: the sub-job index value.

  • EHPC_ARRAY_TASK_COUNT: the total number of sub-jobs.

  • EHPC_ARRAY_TASK_MAX: the maximum sub-job index value, which corresponds to the IndexStart parameter.

  • EHPC_ARRAY_TASK_MIN: the minimum sub-job index value, which corresponds to the IndexEnd parameter.

  • EHPC_ARRAY_TASK_STEP: the sub-job index step, which corresponds to the IndexStep parameter.

IndexEnd

integer

No

The end value of the array job index. Valid values: 0 to 4999. The value must be greater than or equal to the value of IndexStart.

9

IndexStart

integer

No

The start value of the array job index. Valid values: 0 to 4999.

0

IndexStep

integer

No

The step of the array job index.

Note

If the array job attributes are IndexStart=1, IndexEnd=5, and IndexStep=2, the array job includes three sub-jobs with the index values of 1, 3, and 5. Your business programs can access these values through environment variables.

1

MaxCount

integer

No

The maximum number of nodes on which the job can run.

Note

The value must meet the following formula: MaxCount = (IndexEnd - IndexStart) / IndexStep + 1.

1

TaskName

string

No

The task name. The name must be 2 to 32 characters in length and can contain letters, Chinese characters, and digits. It can also contain hyphens (-) and underscores (_).

task0

TaskSpec

object

No

The task specification details.

Resource

object

No

The resource information of the runtime environment.

Cores

number

No

The number of CPUs in the runtime environment.

2

Disks

array<object>

No

The cloud disk array.

object

No

The cloud disk array.

Size

integer

No

The size of the cloud disk. Unit: GiB.

40

Type

string

No

The cloud disk type. Only System is supported, which indicates a system cloud disk.

System

EnableHT

boolean

No

Specifies whether to enable hyper-threading in the runtime environment. Default value: true.

true

HostNamePrefix

string

No

The hostname prefix of the runtime environment. The limits are as follows:

  • A period (.) and a hyphen (-) cannot be used as the first or last character, and cannot be used consecutively.

  • Windows environment: The length cannot exceed 10 characters. Periods (.) are not supported, and the name cannot contain only digits. It can contain uppercase and lowercase letters, digits, and hyphens (-).

  • Linux environment: The length cannot exceed 32 characters. Multiple periods (.) are supported. The string between two periods is a segment, and each segment can contain uppercase and lowercase letters, digits, and hyphens (-).

compute

InstanceTypes

array

No

The instance types of the runtime environment. Up to five instance types are supported.

string

No

The instance type of the runtime environment.

Note

This parameter takes effect only when the DeploymentPolicy.AllocationSpec parameter is set to Standard.

ecs.c7a.8xlarge

Memory

number

No

The memory size of the runtime environment. Unit: GiB.

4

RetryPolicy

object

No

The task retry policy.

ExitCodeActions

array<object>

No

The retry rules. Up to 10 rules are supported.

object

No

The retry rule.

Action

string

Yes

The next action of the task.

  • Retry: The job starts a new retry when a specific exit code is matched.

  • Exit: The job exits when a specific exit code is matched.

Retry

ExitCode

integer

Yes

The task exit code, which is used together with Action to form the job retry rule. Valid values: 0 to 255.

1

RetryCount

integer

No

The number of retries. Valid values: 1 to 10. Default value: 3.

5

TaskExecutor

array<object>

Yes

The task execution configuration.

array<object>

No

The task execution configuration.

Container

object

No

The container environment.

AppId

string

No

The container application ID.

ci-vm-32k6LXAi3cOG

Arg

array

No

The arguments for the container startup command. Up to 10 arguments are supported.

string

No

The argument for the container startup command.

60s

Command

array

No

The list of container startup commands. Up to 20 commands are supported, and each command can be up to 256 characters in length.

Note
  1. If the startup command contains spaces (for example, sleep 60s), the passed JSON parameter is ["sleep", "60s"].

  2. If the startup command is complex, you can use a combination of Command: ["/bin/bash"] and Arg:["-c", "<customized command>"]. <customized command> is a custom command combination defined by the user and can contain spaces and other characters.

string

No

The content of the container startup command. Each command can contain up to 256 characters.

sleep

EnvironmentVars

array<object>

No

The environment variables of the container. Up to 20 environment variables are supported.

object

No

The environment variable of the container.

Name

string

No

The name of the environment variable. The name must be 1 to 128 characters in length and can contain letters, digits, and underscores (_). It cannot start with a digit.

PATH

Value

string

No

The value of the environment variable. The value must be 0 to 256 characters in length.

/usr/local/bin

GpuDriverVersion

string

No

Specifies the GPU driver version.

tesla=535

Image

string

Yes

The container image.

registry-vpc.cn-hangzhou.aliyuncs.com/ehpc/hpl:latest

ImageRegistryOptions

string

No

The mount parameters for a self-managed image registry. The parameters are in key-value pairs and passed in JSON format.

  • Reference format: {"ImageRegistryType":"https","ImageRegistryServer":"xxx","ImageRegistryUserName":"xxx","ImageRegistryPassword":"xxx"}

{"ImageRegistryType":"https","ImageRegistryServer":"xxx","ImageRegistryUserName":"xxx","ImageRegistryPassword":"xxx"}

Privileged

boolean

No

Specifies whether to run the container in privileged mode. Default value: false.

true

WorkingDir

string

No

The working directory of the container.

/usr/local/

VM

object

No

The virtual machine environment.

AppId

string

No

The virtual machine application ID.

ci-vm-9jc58Pm5Leky

EnvironmentVars

array<object>

No

The environment variables of the virtual machine.

object

No

The environment variables of the virtual machine.

Name

string

No

The name of the environment variable.

PATH

Value

string

No

The value of the environment variable.

/usr/local/bin

Image

string

Yes

The image ID.

m-xxxx

Password

string

No

The logon password for the virtual machine environment. The password must be 8 to 30 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include:

()`~!@#$%^&*-_+=|{}[]:;'<>,.?/ In a Windows environment, the password cannot start with a forward slash (/).

Note

If you specify the Password parameter, use HTTPS to send requests to prevent password leaks.

EHPC@1234

PrologScript

string

No

The pre-processing script. The script must be Base64-encoded.

ZWNobyBoZWxsbyBlY3Mh

Script

string

No

The job execution script. The script must be Base64-encoded.

ZWNobyBoZWxsbyBlY3Mh

VolumeMount

array<object>

No

The list of data volumes mounted to the task. Up to 10 data volumes are supported.

object

No

The data volume mounted to the task.

MountOptions

string

No

The mount parameters for the data volume. The parameters are in key-value pairs and passed in JSON format.

  • Reference format for mounting NAS: {"server":"xxxxx-xxxxx.cn-heyuan.nas.aliyuncs.com","vers":"3","path":"/data","options":"nolock,tcp,noresvport"}

Note

server indicates the mount target address of the NAS file system; path indicates the subdirectory under the NAS path, which must start with / and must already exist; vers indicates the NFS protocol version used to mount the NAS file system, and v3 is recommended; options indicates the custom parameters used when mounting the NAS file system, in the format of "xxx,xxx,xxx".

  • Reference format for mounting OSS: {"bucket":"xxxxx", "url":"oss-cn-heyuan-internal.aliyuncs.com","path":"/data","akId":"xxxxx","akSecret":"xxxxx"}

Note

bucket indicates the name of the OSS bucket; url indicates the endpoint of the OSS bucket, which can be obtained on the Overview page of the bucket in the OSS console; path indicates the directory structure relative to the root directory of the bucket when mounting, which defaults to / and must already exist; akId indicates the AccessKey ID used for direct authorization with an AccessKey pair; akSecret indicates the AccessKey secret used for direct authorization with an AccessKey pair.

{"server":"xxxxx-xxxxx.cn-heyuan.nas.aliyuncs.com","vers":"3","path":"/data","options":"nolock,tcp,noresvport"}

MountPath

string

No

The directory where the data volume is mounted to the task.

Note

The content in the mount directory will be directly overwritten by the content of the volume. Use this parameter with caution.

/mnt

ReadOnly

boolean

No

Specifies whether the data volume is read-only. Default value: false.

false

VolumeDriver

string

No

The supported data volume types.

  • alicloud/nas: mounts a NAS file system.

  • alicloud/oss: mounts an OSS bucket.

alicloud/nas

TaskSustainable

boolean

No

Specifies whether the job runs for a long time.

  • true: The job is a background service job.

  • false: The job is a batch job.

Default value: false.

Valid values:

  • false :

    false

  • true :

    true

true

DeploymentPolicy

object

No

The resource deployment policy.

AllocationSpec

string

No

The resource type.

  • Standard: standard.

  • Dedicated: dedicated. A whitelist is required.

  • Economic: economic. A whitelist is required.

Dedicated

Level

string

No

The computing power level. This parameter is valid only when the resource type is Economic. Valid values:

  • General: general-purpose.

  • Performance: performance-optimized.

Default value: General.

General

Network

object

No

The network configuration information.

EnableExternalIpAddress

boolean

No

Specifies whether to create a public IP address for the job.

  • true: creates a public IP address.

  • false: does not create a public IP address.

Default value: false.

Valid values:

  • false :

    false

  • true :

    true

true

Vswitch

array

No

The vSwitch array.

string

No

The vSwitch ID.

vsw-xxxx

Pool

string

No

The job resource pool.

compute

Priority

integer

No

The job priority. A larger value indicates a higher scheduling priority for the job. Valid values: 1 to 100.

1

Tag

array<object>

No

The tags of the job. You can specify up to 20 tags.

object

No

The tag of the job.

Key

string

Yes

The tag key. If you specify this parameter, it cannot be an empty string. The tag key can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

TestKey

Value

string

No

The tag value. If you specify this parameter, it can be an empty string. The tag value can be up to 128 characters in length and cannot contain http:// or https://.

TestValue

SecurityPolicy

object

No

The type of the job scheduler. Valid values:

  • HPC

  • K8S

Default value: HPC.

HPC

SecurityGroup

object

No

The security group.

SecurityGroupIds

array

No

The security group IDs.

string

No

The security group ID.

sg-xxxxxxxxxxxxxxx

DependencyPolicy

object

No

The security policy.

JobDependency

array<object>

No

The job dependencies. You can specify up to 10 dependencies.

object

No

The job dependency.

JobId

string

Yes

The job ID.

job-bjxxxxxxxxxxxx

Type

string

No

The dependency type. Valid values:

  • AfterSucceeded: All subtasks of the dependent job or array job run successfully (the exit code is 0).

  • AfterFailed: Any subtask of the dependent job or array job fails (the exit code is not 0).

  • AfterAny: The dependent job finishes running, regardless of whether it succeeds or fails.

  • AfterCorresponding: The corresponding subtask of the dependent array job runs successfully (the exit code is 0). Default value: AfterSucceeded.

Valid values:

  • AfterFailed :

    依赖作业或数组作业任一子任务运行失败

  • AfterSucceeded :

    依赖作业或数组作业全部子任务运行成功

  • AfterCorresponding :

    依赖数组作业对应子任务运行成功

  • AfterAny :

    依赖作业运行结束

AfterSucceeded

JobTemplateId

string

No

The dependency policy.

jt-xxxx

Response elements

Element

Type

Description

Example

object

Schema of Response

JobId

string

The job ID.

job-xxxx

RequestId

string

The request ID.

896D338C-E4F4-41EC-A154-D605E5DE****

Tasks

array<object>

The list of tasks.

object

The task details.

ExecutorIds

array

The list of executor IDs included in the task.

string

The executor ID. The format is JobId-TaskName-ArrayIndex.

[\"job-xxxx-task0_11-2\"]

TaskName

string

The task name.

task0

Examples

Success response

JSON format

{
  "JobId": "job-xxxx",
  "RequestId": "896D338C-E4F4-41EC-A154-D605E5DE****",
  "Tasks": [
    {
      "ExecutorIds": [
        "[\\\"job-xxxx-task0_11-2\\\"]"
      ],
      "TaskName": "task0"
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The specified parameter %s is invalid. The specified parameter %s is invalid.
400 InDebt Your account has overdue payments. Your account has overdue payments.
400 NotEnabled You have not enabled this service. You have not enabled this service
403 GetResourceFailed Failed to get resource. Failed to get resource
403 RecommendEmpty.InstanceTypeSoldOut The resource is out of stock. Resources are sold out
403 DuplicateTagKey Duplicate tag key exists: %s. Duplicate tag key exists.
403 PoolNotFound The specified pool was not found. Resource pool does not exist
403 PoolStatusInvalid The specified pool in invalid status. Invalid Resource Pool Status
403 QuotaExceeded.PrivateIpAddress Insufficient private IP addresses in vSwitch: %s.
403 SecurityGroupInstanceLimitExceed The maximum number of instances in a security group is exceeded. The number of instances in the security group has reached the maximum limit.
403 QuotaExceeded.Resource Insufficient resource quota. Insufficient resource quota
403 QuotaExceeded.Executor Insufficient pool executor quota. The resource pool execution node quota is insufficient.
404 ImageNotFound The specified image does not exist. The specified image does not exist. Please verify the parameter.
404 SecurityGroupNotExists The security group does not exist. The security group does not exist.
404 JobTemplateNotFound The specified job template is not found. The specified job template does not exist.
406 AliyunError An Alibaba Cloud product error occurred. Alibaba Cloud product error. %s
406 EcsError An error occurred while calling the ECS API operation. An error occurred while calling the ECS API operation.
406 DbError A database error occurred. A database error occurred.
406 TagError Tag operation error. Tag operation error.
407 NotAuthorized No authorization is granted. No authorization is granted.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.