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

#### 产品支持情况

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


#### 功能说明

异步任务场景下，取消线程订阅，Stream上的回调函数不再由指定线程处理。

本接口需与以下其它接口配合使用，以便实现异步场景下的Callback功能：1. 新建线程，在线程函数内，调用  acl.rt.process_report
接口设置超时时间（需循环调用），等待  acl.rt.launch_callback
接口下发的函数回调任务。
2. 调用  acl.rt.subscribe_report
接口建立第1步中的线程和Stream的绑定关系，该Stream下发的函数回调任务将在绑定的线程中执行。
3. 在指定Stream上执行异步任务（例如异步推理任务）。
4. 定义并实现回调函数，调用acl.rt.launch_callback接口在Stream的任务队列中下发函数回调任务，触发acl.rt.subscribe_report订阅的线程处理回调函数，每调用一次acl.rt.launch_callback接口，就会下发一个回调函数任务。
5. 异步任务全部执行完成后，调用  acl.rt.unsubscribe_report
接口取消线程订阅，解除线程和Stream的绑定关系。


#### 函数原型

- C函数原型
  1 aclError aclrtUnSubscribeReport(uint64_t threadId, aclrtStream stream)

- python函数
  1 ret = acl.rt.unsubscribe_report(thread_id, stream)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| thread\_id | int，指定线程id。 |
| stream | int，指定需要处理的Stream的指针地址。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |


#### 资源参考

- 接口调用流程，参见  接口调用流程(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/aclpythondevg_0037.html)
。
- 接口调用示例，参见  示例代码(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/aclpythondevg_0038.html)
。
