---
title: 函数：get_thread_last_task_id
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_1055.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_1055.html
indexId: 2621735bef60c75462a23a371bba74f87b56684cf9ee7fe47a51d832e5ce46d471
---
# 函数：get_thread_last_task_id

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

获取当前线程的最后一个下发的Task ID。


#### 函数原型

- C函数原型
  1 aclError aclrtGetThreadLastTaskId(uint32_t *taskId)

- python函数
  1 task_id, ret = acl.rt.get_thread_last_task_id()


#### 参数说明

无


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| taskId | unsigned int，Task ID。当前线程的最后一个下发的Task ID。此处的Task表示由用户显式创建的Stream上下发的Task。 |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |
