GetJobTemplate

Updated at:

Queries the details of a job template.

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:GetJobTemplate

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

JobTemplateId

string

Yes

The job template ID.

jt-xxxx

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

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

JobTemplateId

string

The job template ID.

jt-xxxx

JobTemplateName

string

The template name.

my-template

JobTemplateDescription

string

The template description.

Demo

Status

string

The status of the job template.

Working

JobTemplateConfig

object

The template configuration.

JobName

string

The job name.

test-job

JobDescription

string

The job description.

Demo

DeploymentPolicy

object

The resource deployment policy.

AllocationSpec

string

The resource type.

Dedicated

Network

object

The network configuration.

Vswitch

array

The vSwitches.

vsw-xxxx

string

The vSwitch ID.

vsw-xxx

EnableExternalIpAddress

boolean

Specifies whether to create a public IP address for the job. Default value: false.

false

Level

string

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

  • General: general-purpose.

  • Performance: compute-optimized.

General

Pool

string

The job resource pool.

my-pool

Priority

integer

The job priority. A larger value indicates a higher scheduling priority for the job.

1

Tags

array<object>

The tags of the job.

object

Key

string

The tag key.

TestKey

Value

string

The tag value.

TestValue

SecurityPolicy

object

The security policy.

SecurityGroup

object

The security group.

SecurityGroupIds

array

The security group IDs.

sg-xxxx

string

The security group ID.

sg-xxx

JobScheduler

string

The job scheduler type.

HPC

Tasks

array<object>

The tasks.

array<object>

TaskName

string

The task name.

task0

TaskSpec

object

The task specifications.

TaskExecutor

array<object>

The task execution configuration.

array<object>

Container

object

The container environment.

Image

string

The container image.

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

WorkingDir

string

The working directory of the container.

/usr/local/

Command

array

The startup commands of the container.

sleep

string

The startup command of the container.

sleep

Arg

array

The arguments for the container startup commands.

60s

string

The arguments for the container startup commands.

60s

EnvironmentVars

array<object>

The environment variables of the container.

object

Name

string

The name of the environment variable.

PATH

Value

string

The value of the environment variable.

/usr/local/bin

AppId

string

The application ID of the container.

ci-vm-32k6LXAi3cOG

Privileged

boolean

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

true

ImageRegistryOptions

string

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

{}

GpuDriverVersion

string

The GPU driver version.

tesla=535

VM

object

The virtual machine environment.

Image

string

The image ID.

m-xxxx

PrologScript

string

The prolog script. It must be Base64-encoded.

ZWNobyBoZWxsbyBlY3Mh

Script

string

The job script. It must be Base64-encoded.

ZWNobyBoZWxsbyBlY3Mh

AppId

string

The VM application ID.

ci-vm-9jc58Pm5Leky

Password

string

The logon password for the VM environment.

EHPC@1234

VolumeMount

array<object>

The list of data volumes mounted to the task. A maximum of 10 volumes can be mounted.

object

MountPath

string

The mount path of the data volume for the task.

/mnt

VolumeDriver

string

The type of the data volume.

alicloud/nas

MountOptions

string

The list of mount options for the data volume. The options are passed in JSON format as key-value pairs.

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

ReadOnly

boolean

Indicates whether the data volume is read-only.

false

Resource

object

The resource information of the runtime environment.

Cores

number

The number of CPU cores in the runtime environment.

2

Memory

number

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

4

EnableHT

boolean

Indicates whether hyper-threading is enabled in the runtime environment.

true

Disks

array<object>

The array of cloud disks.

object

Type

string

The type of the cloud disk.

System

Size

integer

The size of the cloud disk. Unit: GiB.

40

HostNamePrefix

string

The hostname prefix of the runtime environment.

compute

InstanceTypes

array

The instance types of the runtime environment.

ecs.c7a.8xlarge

string

The instance types of the runtime environment.

ecs.c7.2xlarge

RetryPolicy

object

The retry policy for the task.

RetryCount

integer

The number of retries.

5

ExitCodeActions

array<object>

The retry rules.

object

ExitCode

integer

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

1

Action

string

The next action of the task. Valid values: Retry: retries the task. Exit: exits the task.

Retry

ExecutorPolicy

object

The execution policy of the task.

MaxCount

integer

The maximum number of nodes for the job execution.

1

ArraySpec

object

The details of the array job.

IndexStart

integer

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

0

IndexEnd

integer

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

9

IndexStep

integer

The step size of the array job index.

1

TaskSustainable

boolean

Indicates whether the job is a long-running job. Valid values: true: The job is a background service job. false: The job is a batch job. Default value: false.

false

CreateTime

string

The creation time. The time is in the YYYY-MM-DD HH:mm:ss format.

2026-04-20 11:09:59

UpdateTime

string

The update time. The time is in the YYYY-MM-DD HH:mm:ss format.

2026-04-20 11:09:59

Examples

Success response

JSON format

{
  "RequestId": "896D338C-E4F4-41EC-A154-D605E5DE****",
  "JobTemplateId": "jt-xxxx",
  "JobTemplateName": "my-template",
  "JobTemplateDescription": "Demo",
  "Status": "Working",
  "JobTemplateConfig": {
    "JobName": "test-job",
    "JobDescription": "Demo",
    "DeploymentPolicy": {
      "AllocationSpec": "Dedicated",
      "Network": {
        "Vswitch": [
          "vsw-xxx"
        ],
        "EnableExternalIpAddress": false
      },
      "Level": "General",
      "Pool": "my-pool",
      "Priority": 1,
      "Tags": [
        {
          "Key": "TestKey",
          "Value": "TestValue"
        }
      ]
    },
    "SecurityPolicy": {
      "SecurityGroup": {
        "SecurityGroupIds": [
          "sg-xxx"
        ]
      }
    },
    "JobScheduler": "HPC",
    "Tasks": [
      {
        "TaskName": "task0",
        "TaskSpec": {
          "TaskExecutor": [
            {
              "Container": {
                "Image": "registry-vpc.cn-hangzhou.aliyuncs.com/ehpc/hpl:latest",
                "WorkingDir": "/usr/local/",
                "Command": [
                  "sleep"
                ],
                "Arg": [
                  "60s"
                ],
                "EnvironmentVars": [
                  {
                    "Name": "PATH",
                    "Value": "/usr/local/bin"
                  }
                ],
                "AppId": "ci-vm-32k6LXAi3cOG",
                "Privileged": true,
                "ImageRegistryOptions": "{}",
                "GpuDriverVersion": "tesla=535"
              },
              "VM": {
                "Image": "m-xxxx",
                "PrologScript": "ZWNobyBoZWxsbyBlY3Mh",
                "Script": "ZWNobyBoZWxsbyBlY3Mh",
                "AppId": "ci-vm-9jc58Pm5Leky",
                "Password": "EHPC@1234"
              }
            }
          ],
          "VolumeMount": [
            {
              "MountPath": "/mnt",
              "VolumeDriver": "alicloud/nas",
              "MountOptions": "{\"server\":\"xxxxx-xxxxx.cn-heyuan.nas.aliyuncs.com\",\"vers\":\"3\",\"path\":\"/data\",\"options\":\"nolock,tcp,noresvport\"}",
              "ReadOnly": false
            }
          ],
          "Resource": {
            "Cores": 2,
            "Memory": 4,
            "EnableHT": true,
            "Disks": [
              {
                "Type": "System",
                "Size": 40
              }
            ],
            "HostNamePrefix": "compute",
            "InstanceTypes": [
              "ecs.c7.2xlarge"
            ]
          },
          "RetryPolicy": {
            "RetryCount": 5,
            "ExitCodeActions": [
              {
                "ExitCode": 1,
                "Action": "Retry"
              }
            ]
          }
        },
        "ExecutorPolicy": {
          "MaxCount": 1,
          "ArraySpec": {
            "IndexStart": 0,
            "IndexEnd": 9,
            "IndexStep": 1
          }
        },
        "TaskSustainable": false
      }
    ]
  },
  "CreateTime": "2026-04-20 11:09:59",
  "UpdateTime": "2026-04-20 11:09:59"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The specified parameter %s is invalid. The specified parameter %s is invalid.
404 JobTemplateNotFound The specified job template is not found. The specified job template does not exist.
406 DbError A database error occurred. A database error occurred.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.