调用GetJob获取任务的详细配置和运行时信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求语法

GET /api/v1/jobs/JobId HTTP/1.1
Content-Type:application/json

请求参数

表 1. 请求Path参数
参数名称 类型 是否必选 示例 说明
JobId String dlc-20210126170216-xxxxxxx

任务ID。您可以调用ListJobs获取满足过滤条件的任务的ID;调用CreateJob的返回值中也可以获取刚创建的任务ID。

响应体语法

HTTP/1.1 200 OK
Content-Type:application/json

{
  "JobId" : "String",
  "JobType" : "String",
  "DisplayName" : "String",
  "UserId" : "String",
  "Status" : "String",
  "ReasonCode" : "String",
  "ReasonMessage" : "String",
  "JobSpecs" : [ {
    "Type" : "String",
    "Image" : "String",
    "PodCount" : Long,
    "EcsSpec" : "String"
  } ],
  "UserCommand" : "String",
  "DataSources" : [ {
    "DataSourceId" : "String"
  } ],
  "CodeSource" : {
    "CodeSourceId" : "String",
    "Branch" : "String",
    "Commit" : "String"
  },
  "ThirdpartyLibs" : [ "String" ],
  "ThirdpartyLibDir" : "String",
  "GmtCreateTime" : "String",
  "GmtFinishTime" : "String",
  "Duration" : Long,
  "Pods" : [ {
    "Type" : "String",
    "PodId" : "String",
    "Status" : "String",
    "Ip" : "String",
    "GmtGreateTime" : "String",
    "GmtStartTime" : "String",
    "GmtFinishTime" : "String"
  } ],
  "RequestId" : "String"
}

响应参数

表 2. 响应Body参数
参数名称 类型 示例 说明
JobId String dlc-20210126170216-xxxxxx

任务ID

JobType String TFJob

任务类型;由CreateJob API中的JobType指定。

DisplayName String tf-mnist-test

任务名称

UserId String 123456789

任务提交人的阿里云UID

Status String Stopped

任务运行状态,枚举类型如下:

  • Created
  • Creating
  • Running
  • Succeeded
  • Failed
  • Stopped
ReasonCode String JobStoppedByUser

状态详情码,对当前状态(Status)下的子状态的一个分类。

ReasonMessage String Job is stopped by user.

状态详情的详细描述。

JobSpecs Array of JobSpec

任务中的节点配置,参考CreateJob API中的JobSpecs

UserCommand String python /root/code/mnist.py

每个节点的启动命令

DataSources Array of DataSources

数据源列表

DataSourceId String data-20210114104214-xxxxx

数据源ID

CodeSource Object

代码源

CodeSourceId String code-20210111103721-xxxxx

代码源ID

Branch String master

代码分支

Commit String 44da109b59f8596152987eaa8f3b2487xxxxxx

代码CommitID

ThirdpartyLibs Array of String numpy==1.16.1

第三方Python库

ThirdpartyLibDir String /root/code/

三方库(requirements.txt)文件所在文件夹。

Envs Map

环境变量配置

String ENABLE_DEBUG_MODE

环境变量Key和Value

GmtCreateTime String 2021-01-12T14:35:01Z

任务创建时间(UTC)

GmtFinishTime String 2021-01-12T15:36:08Z

任务结束时间(UTC)

Duration Long 3602

任务运行时长,单位:秒。

Pods Array of Pods

任务运行中的所有节点。

Type String Worker

节点类型;与CreateJob中的JobSpecs中的某个JobSpec对应

PodId String dlc-20210126170216-mtlxxxxx-worker-0

节点ID,可用于GetPodLogs 和GetPodEvents API获取节点的详细日志和事件。

Status String Running

节点状态。枚举值:

  • Pending
  • Running
  • Succeeded
  • Failed
  • Unknown
Ip String 10.0.1.2

节点的网络IP地址

GmtGreateTime String 2021-01-12T14:36:01Z

节点创建时间(UTC)

GmtStartTime String 2021-01-12T14:36:05Z

节点启动时间(UTC)

GmtFinishTime String 2021-01-12T15:36:05Z

节点结束时间(UTC)

RequestId String 473469C7-AA6F-4DC5-B3DB-xxxxxxxx

请求ID,用于诊断和答疑。

获取一个任务的详情

GET /api/v1/jobs/dlc-20210126170216-xxxxxxx HTTP/1.1 
Host:pai-dlc.aliyuncs.com 
Content-Type:application/json

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<JobId>dlc-20210126170216-xxxxxx</JobId>
<JobType>TFJob</JobType>
<DisplayName>tf-mnist-test</DisplayName>
<UserId>123456789</UserId>
<Status>Stopped</Status>
<ReasonCode>JobStoppedByUser</ReasonCode>
<ReasonMessage>Job is stopped by user.</ReasonMessage>
<JobSpecs>
    <Type>Worker</Type>
    <Image>registry.cn-hangzhou.aliyuncs.com/pai-dlc/tensorflow-training:1.12.2PAI-cpu-py27-ubuntu16.04</Image>
    <PodCount>1</PodCount>
    <EcsSpec>ecs.c6.large</EcsSpec>
</JobSpecs>
<UserCommand>python /root/code/mnist.py</UserCommand>
<DataSources>
    <DataSourceId>data-20210114104214-xxxxx</DataSourceId>
</DataSources>
<CodeSource>
    <CodeSourceId>code-20210111103721-xxxxx</CodeSourceId>
    <Branch>master</Branch>
    <Commit>44da109b59f8596152987eaa8f3b2487xxxxxx</Commit>
</CodeSource>
<ThirdpartyLibs>numpy==1.16.1</ThirdpartyLibs>
<ThirdpartyLibDir>/root/code/</ThirdpartyLibDir>
<GmtCreateTime>2021-01-12T14:35:01Z</GmtCreateTime>
<GmtFinishTime>2021-01-12T15:36:08Z</GmtFinishTime>
<Duration>3602</Duration>
<Pods>
    <Type>Worker</Type>
    <PodId>dlc-20210126170216-mtlxxxxx-worker-0</PodId>
    <Status>Running</Status>
    <Ip>10.0.1.2</Ip>
    <GmtGreateTime>2021-01-12T14:36:01Z</GmtGreateTime>
    <GmtStartTime>2021-01-12T14:36:05Z</GmtStartTime>
    <GmtFinishTime>2021-01-12T15:36:05Z</GmtFinishTime>
</Pods>
<RequestId>473469C7-AA6F-4DC5-B3DB-xxxxxxxx</RequestId>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "JobId" : "dlc-20210126170216-xxxxxx",
  "JobType" : "TFJob",
  "DisplayName" : "tf-mnist-test",
  "UserId" : "123456789",
  "Status" : "Stopped",
  "ReasonCode" : "JobStoppedByUser",
  "ReasonMessage" : "Job is stopped by user.",
  "JobSpecs" : [ {
    "Type" : "Worker",
    "Image" : "registry.cn-hangzhou.aliyuncs.com/pai-dlc/tensorflow-training:1.12.2PAI-cpu-py27-ubuntu16.04",
    "PodCount" : 1,
    "EcsSpec" : "ecs.c6.large"
  } ],
  "UserCommand" : "python /root/code/mnist.py",
  "DataSources" : [ {
    "DataSourceId" : "data-20210114104214-xxxxx"
  } ],
  "CodeSource" : {
    "CodeSourceId" : "code-20210111103721-xxxxx",
    "Branch" : "master",
    "Commit" : "44da109b59f8596152987eaa8f3b2487xxxxxx"
  },
  "ThirdpartyLibs" : [ "numpy==1.16.1" ],
  "ThirdpartyLibDir" : "/root/code/",
  "GmtCreateTime" : "2021-01-12T14:35:01Z",
  "GmtFinishTime" : "2021-01-12T15:36:08Z",
  "Duration" : 3602,
  "Pods" : [ {
    "Type" : "Worker",
    "PodId" : "dlc-20210126170216-mtlxxxxx-worker-0",
    "Status" : "Running",
    "Ip" : "10.0.1.2",
    "GmtGreateTime" : "2021-01-12T14:36:01Z",
    "GmtStartTime" : "2021-01-12T14:36:05Z",
    "GmtFinishTime" : "2021-01-12T15:36:05Z"
  } ],
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-xxxxxxxx"
}

错误码

访问错误中心查看更多错误码。

开发者资源

  • SDK

    阿里云为您提供多种语言的SDK,帮助您快速通过API集成阿里云的产品和服务,推荐您使用SDK调用API,已免除您手动签名验证。

  • OpenAPI Explorer

    快速检索,可视化调试API,在线命令行工具,同步动态生成可执行的SDK代码示例。

  • 阿里云CLI

    阿里云资产管理和配置工具,可通过命令方式同时管理多个阿里云产品和服务,简单快捷,是您上云好帮手。