GetTrainingJob - 获取训练任务详情

更新时间:
复制为 MD 格式

获取训练任务的详情。

调试

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

授权信息

当前API暂无授权信息透出。

请求语法

GET /api/v1/trainingjobs/{TrainingJobId} HTTP/1.1

请求参数

名称类型必填描述示例值
TrainingJobIdstring

训练任务 ID。

train129f212o89d

返回参数

名称类型描述示例值
object
OutputChannelsarray<object>

训练输出数据配置。

输出的Channel列表object

训练输出数据配置。

Namestring

输出数据名称。

model
OutputUristring

输出数据链接地址。

oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/output/model/
DatasetIdstring

数据集 ID。

d-8o0hh35po15ejcdq2p
VersionNamestring

数据集版本。

v1
Statusstring

任务状态。

Running
HyperParametersarray<object>

训练超参数配置。

算法超参数object

训练超参数配置。

Namestring

参数名。

learning_rate
Valuestring

参数值。

0.0001
TrainingJobNamestring

训练任务名称。

qwen_llm
TrainingJobIdstring

训练任务 ID。

traini6hhxiq69eo
Schedulerobject

训练任务调度配置。

MaxRunningTimeInSecondsstring

最大训练运行时长,单位为秒。数值为 0 时不限制最大运行时常。

0
MaxRunningTimeInMinutesstring

最大运行时长(分钟)。

100
ReasonMessagestring

训练任务错误原因。

None
WorkspaceIdstring

工作空间 ID。

86995
ComputeResourceobject

计算资源配置。

EcsCountlong

Ecs 实例数。

1
EcsSpecstring

Ecs 型号。

ecs.gn5-c8g1.2xlarge
ResourceIdstring

资源配额(Quota)ID。

quotam670lixikcl
ResourceNamestring

资源配额名称。

quota
InstanceCountlong

资源配额使用实例数。

1
InstanceSpecobject

资源配额实例配置。

CPUstring

实例 CPU 核数。

8
Memorystring

实例内存大小,单位为 GiB。

32
SharedMemorystring

实例共享内存大小,单位为 GiB。

32
GPUstring

实例 GPU 显卡数量。

1
GPUTypestring

实例 GPU 显卡型号。

V100
UseSpotInstanceboolean

是否使用抢占式实例。

true
SpotSpecobject

抢占式实例配置。

SpotStrategystring

SpotStrategy: 实例的抢占策略,取值范围:

  • SpotWithPriceLimit:设置上限价格的抢占式实例。
  • SpotAsPriceGo:系统自动出价,跟随当前市场实际价格。
SpotWithPriceLimit
SpotDiscountLimitfloat

设置实例的每小时最高价格折扣,参数 SpotStrategy 取值为 SpotWithPriceLimit 时生效。

0.9
Labelsarray<object>

训练任务标签列表。

作业的Labelsobject

训练任务标签。

Keystring

标签名。

CreatedBy
Valuestring

标签值。

QuickStart
AlgorithmProviderstring

算法提供方。

pai
InputChannelsarray<object>

训练输入数据配置。

输入的Channel列表object

训练输入数据配置。

DatasetIdstring

数据集 ID。

d-475megosidivjfgfq6
Namestring

输入数据名称。

model
InputUristring

输入数据链接。

oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/input/model/
Optionsstring

输入数据的文件系统参数。

ossAppendable=true
VersionNamestring

数据集版本。

v1
AlgorithmNamestring

算法名。

llm_training
ReasonCodestring

训练任务状态码。

TrainingJobSucceed
GmtModifiedTimestring

训练任务状态更新时间。

2024-07-10T11:49:47Z
StatusTransitionsarray<object>

训练任务状态变更列表。

作业的历史状态列表object

训练任务状态变更。

EndTimestring

状态结束时间。

2024-07-10T11:49:47Z
ReasonCodestring

状态码。

TrainingJobSucceed
ReasonMessagestring

状态更新信息。

KubeDL job runs successfully
StartTimestring

状态开始时间。

2024-07-10T11:49:47Z
Statusstring

训练任务状态。

Creating
TrainingJobDescriptionstring

训练任务描述。

Qwen2大语言模型训练。
UserIdstring

用户 ID。

123456789
AlgorithmVersionstring

算法版本。

v0.0.1
LatestMetricsarray<object>

训练任务指标列表。

最近的Metric列表object

训练任务监控指标。

Namestring

指标名。

loss
Timestampstring

指标收集时间。

2024-07-10T11:49:47Z
Valuedouble

指标值。

0.11
GmtCreateTimestring

训练任务创建时间。

2024-07-10T11:49:47Z
RequestIdstring

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
Instancesarray<object>

训练任务实例列表。

job实例object

训练任务实例。

Namestring

实例名。

train1oug3yehan4-master-0
Rolestring

实例角色。

master
Statusstring

实例状态。

Succeeded
AlgorithmIdstring

训练算法 ID。

algo-xsldfvu1334
TrainingJobUrlstring

训练任务详情地址。

https://pai.console.aliyun.com/?regionId=cn-hangzhou&workspaceId=1234#/training/jobs/train1ouyadsl8n4
RoleArnstring

代理授权使用的角色信息。

acs:ram::{accountID}:role/{roleName}
AlgorithmSpecAlgorithmSpec

临时算法定义。

IsTempAlgoboolean

是否使用了临时算法。

true
LatestProgressobject

训练任务进度的最新值。

OverallProgressobject

训练任务执行的总体进度。

Timestampstring

进度时间。

2023-07-04T13:20:18Z
Valuefloat

进度值。

0.75
RemainingTimeobject

训练任务执行的预估剩余时间(单位秒)。

Timestampstring

进度时间。

2023-07-04T13:20:18Z
Valuelong

剩余时间(单位秒)。

3600
UserVpcobject

用户 VPC 配置。

VpcIdstring

VPC ID。

vpc-abcdef****
SwitchIdstring

交换机 ID。

vs-abcdef****
SecurityGroupIdstring

安全组 ID。

sg-abcdef****
ExtendedCIDRsarray

扩展网段配置。

ExtendedCIDRsstring

扩展网段配置。

192.168.0.1/24
OutputModelobject

训练任务产出的模型。

Uristring

模型地址。

oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/model/output/
OutputChannelNamestring

模型对应的 OutputChannel 名。

model
SettingsJobSettings

训练任务额外参数配置。

ExperimentConfigobject

训练任务关联实验配置。

ExperimentIdstring

训练任务关联实验 ID。

exp-ds9aefia90v
ExperimentNamestring

训练任务关联实验名。

large_language_model_train
Durationlong

训练任务运行时长。单位:秒。

7200
Environmentsobject

训练任务环境变量。

string

训练任务环境变量。

debug=true
PythonRequirementsarray

训练任务 Python 包配置。

Python第三方依赖列表string

训练任务 Python 包配置。

torch>=2.2.0
Priorityinteger

任务优先级。

0

示例

正常返回示例

JSON格式

{
  "OutputChannels": [
    {
      "Name": "model",
      "OutputUri": "oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/output/model/",
      "DatasetId": "d-8o0hh35po15ejcdq2p",
      "VersionName": "v1"
    }
  ],
  "Status": "Running",
  "HyperParameters": [
    {
      "Name": "learning_rate",
      "Value": 0.0001
    }
  ],
  "TrainingJobName": "qwen_llm",
  "TrainingJobId": "traini6hhxiq69eo",
  "Scheduler": {
    "MaxRunningTimeInSeconds": 0,
    "MaxRunningTimeInMinutes": 100
  },
  "ReasonMessage": "None",
  "WorkspaceId": 86995,
  "ComputeResource": {
    "EcsCount": 1,
    "EcsSpec": "ecs.gn5-c8g1.2xlarge",
    "ResourceId": "quotam670lixikcl",
    "ResourceName": "quota",
    "InstanceCount": 1,
    "InstanceSpec": {
      "CPU": 8,
      "Memory": 32,
      "SharedMemory": 32,
      "GPU": 1,
      "GPUType": "V100"
    },
    "UseSpotInstance": true,
    "SpotSpec": {
      "SpotStrategy": "SpotWithPriceLimit",
      "SpotDiscountLimit": 0.9
    }
  },
  "Labels": [
    {
      "Key": "CreatedBy",
      "Value": "QuickStart"
    }
  ],
  "AlgorithmProvider": "pai",
  "InputChannels": [
    {
      "DatasetId": "d-475megosidivjfgfq6",
      "Name": "model",
      "InputUri": "oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/input/model/",
      "Options": "ossAppendable=true",
      "VersionName": "v1"
    }
  ],
  "AlgorithmName": "llm_training",
  "ReasonCode": "TrainingJobSucceed",
  "GmtModifiedTime": "2024-07-10T11:49:47Z",
  "StatusTransitions": [
    {
      "EndTime": "2024-07-10T11:49:47Z",
      "ReasonCode": "TrainingJobSucceed",
      "ReasonMessage": "KubeDL job runs successfully",
      "StartTime": "2024-07-10T11:49:47Z",
      "Status": "Creating"
    }
  ],
  "TrainingJobDescription": "Qwen2大语言模型训练。",
  "UserId": 123456789,
  "AlgorithmVersion": "v0.0.1",
  "LatestMetrics": [
    {
      "Name": "loss",
      "Timestamp": "2024-07-10T11:49:47Z",
      "Value": 0.11
    }
  ],
  "GmtCreateTime": "2024-07-10T11:49:47Z",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "Instances": [
    {
      "Name": "train1oug3yehan4-master-0",
      "Role": "master",
      "Status": "Succeeded"
    }
  ],
  "AlgorithmId": "algo-xsldfvu1334",
  "TrainingJobUrl": "https://pai.console.aliyun.com/?regionId=cn-hangzhou&workspaceId=1234#/training/jobs/train1ouyadsl8n4",
  "RoleArn": "acs:ram::{accountID}:role/{roleName}",
  "AlgorithmSpec": {
    "OutputChannels": [
      {
        "Description": "模型输出。",
        "Required": true,
        "Properties": {},
        "Name": "Model",
        "SupportedChannelTypes": [
          "oss"
        ]
      }
    ],
    "HyperParameters": [
      {
        "DefaultValue": 0,
        "Type": "Integer",
        "Description": "参数定义了训练的batch_size。",
        "Required": true,
        "Name": "batch_size",
        "Range": {
          "Enum": [
            0
          ],
          "MinLength": 1,
          "MaxLength": 30,
          "Minimum": 0,
          "Maximum": 10,
          "ExclusiveMinimum": true,
          "ExclusiveMaximum": true,
          "Pattern": "^\\+?[1-9][0-9]*$"
        },
        "DisplayName": "Batch Size"
      }
    ],
    "JobType": "TFJob",
    "Command": [
      "python train.py"
    ],
    "MetricDefinitions": [
      {
        "Description": "训练损失函数。",
        "Regex": ".*train:loss=([-+]?[0-9]*\\\\.?[0-9]+(?:[eE][-+]?[0-9]+)?).*",
        "Name": "loss"
      }
    ],
    "InputChannels": [
      {
        "Description": "模型输出。",
        "Required": true,
        "Properties": {},
        "Name": "Model",
        "SupportedChannelTypes": [
          "oss"
        ]
      }
    ],
    "SupportsDistributedTraining": true,
    "Image": "registry.cn-shanghai.aliyuncs.com/pai-training/kmeans:v1.0.0",
    "SupportedInstanceTypes": [
      "ecs.g6.2xlarge"
    ],
    "ComputeResource": {
      "Policy": {
        "Version": "V1",
        "Value": "[{\\\"MinTotalCount\\\":1,\\\"MaxTotalCount\\\":4,\\\"RolePolicies\\\":{\\\"chief\\\":{\\\"Count\\\":1},\\\"ps\\\":{\\\"Count\\\":1},\\\"worker\\\":{\\\"Percentage\\\":100}}},{\\\"MinTotalCount\\\":5,\\\"MaxTotalCount\\\":10,\\\"RolePolicies\\\":{\\\"chief\\\":{\\\"Count\\\":1},\\\"ps\\\":{\\\"Percentage\\\":20},\\\"worker\\\":{\\\"Percentage\\\":80}}},{\\\"MinTotalCount\\\":11,\\\"RolePolicies\\\":{\\\"chief\\\":{\\\"Count\\\":1},\\\"ps\\\":{\\\"Percentage\\\":40},\\\"worker\\\":{\\\"Percentage\\\":60}}}]"
      }
    },
    "CodeDir": {
      "LocationType": "OSS",
      "LocationValue": {
        "test": "test",
        "test2": 1
      }
    },
    "Customization": {
      "CodeDir": true
    },
    "ResourceRequirements": [
      {
        "Key": "SupportedMachineTypes",
        "Operator": "in",
        "Values": [
          "ecs.gn5-c4g1.xlarge"
        ]
      }
    ],
    "ProgressDefinitions": {
      "OverallProgress": {
        "Description": "training progress",
        "Regex": "^[0-9]+([.][0-9]+){0,1}$"
      },
      "RemainingTime": {
        "Description": "training remaining time",
        "Regex": "^[0-9]+([.][0-9]+){0,1}$"
      }
    }
  },
  "IsTempAlgo": true,
  "LatestProgress": {
    "OverallProgress": {
      "Timestamp": "2023-07-04T13:20:18Z",
      "Value": 0.75
    },
    "RemainingTime": {
      "Timestamp": "2023-07-04T13:20:18Z",
      "Value": 3600
    }
  },
  "UserVpc": {
    "VpcId": "vpc-abcdef****",
    "SwitchId": "vs-abcdef****",
    "SecurityGroupId": "sg-abcdef****",
    "ExtendedCIDRs": [
      "192.168.0.1/24"
    ]
  },
  "OutputModel": {
    "Uri": "oss://test-bucket.oss-cn-hangzhou-internal.aliyuncs.com/path/to/model/output/",
    "OutputChannelName": "model"
  },
  "Settings": {
    "BusinessUserId": 166924,
    "Caller": "SilkFlow",
    "Tags": {
      "key": ""
    },
    "PipelineId": "pid-123456",
    "EnableTideResource": true,
    "EnableErrorMonitoringInAIMaster": false,
    "ErrorMonitoringArgs": "--enable-log-hang-detection true",
    "EnableRDMA": true,
    "EnableOssAppend": true,
    "OversoldType": "AcceptQuotaOverSold",
    "AdvancedSettings": {
      "test": "test",
      "test2": 1
    },
    "Driver": "535.54.03",
    "EnableSanityCheck": true,
    "SanityCheckArgs": "--sanity-check-timing=AfterJobFaultTolerant --sanity-check-timeout-ops=MarkJobFai",
    "JobReservedMinutes": 30,
    "JobReservedPolicy": "Always"
  },
  "ExperimentConfig": {
    "ExperimentId": "exp-ds9aefia90v",
    "ExperimentName": "large_language_model_train"
  },
  "Duration": 7200,
  "Environments": {
    "key": "debug=true"
  },
  "PythonRequirements": [
    "torch>=2.2.0"
  ],
  "Priority": 0,
  "AssignNodeSpec": {
    "EnableAssignNode": true,
    "NodeNames": "",
    "AntiAffinityNodeNames": ""
  }
}

错误码

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

变更历史

变更时间变更内容概要操作
2025-11-25OpenAPI 返回结构发生变更查看变更详情
2024-11-18OpenAPI 返回结构发生变更查看变更详情
2024-10-17OpenAPI 返回结构发生变更查看变更详情
2024-08-07OpenAPI 返回结构发生变更查看变更详情
2024-07-19OpenAPI 返回结构发生变更查看变更详情
2024-05-09OpenAPI 返回结构发生变更查看变更详情
2024-03-14OpenAPI 返回结构发生变更查看变更详情
2024-02-29OpenAPI 返回结构发生变更查看变更详情
2023-12-26OpenAPI 返回结构发生变更查看变更详情
2023-12-07OpenAPI 返回结构发生变更查看变更详情
2023-09-01OpenAPI 返回结构发生变更查看变更详情
2023-08-15OpenAPI 返回结构发生变更查看变更详情
2023-05-24OpenAPI 返回结构发生变更查看变更详情
2023-04-20OpenAPI 返回结构发生变更查看变更详情
2022-09-14OpenAPI 返回结构发生变更查看变更详情
2022-09-14OpenAPI 返回结构发生变更查看变更详情