> For the complete documentation index, see [llms.txt](https://smallso.gitbook.io/tencent-cloud-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/other-products/class-and-method/waitable/has-done.md).

# has\_done 方法

## 简要

检查与之关联的可等待操作是否已完成。

```python
def has_done(self) -> bool
```

## 参数

该方法没有参数。

## 返回值

如果可等待操作已完成，该方法返回 `True`。

如果可等待操作未完成或从未开始等待过，该方法返回 `False`。

## 异常

该方法不会主动抛出异常。

## 示例

接下来我们将通过一段 Python 代码向您演示如何使用该方法：

```python
from tencent.cloud.core import errors
from tencent.cloud.core import waitable
from tencent.cloud.serverless import functions

def main():
    client: functions.Client = functions.fetch_client()

    create_operation: waitable.Waitable = client.create_layer(
        region_id = 'ap-shanghai',
        layer_name = 'default',
        layer_description = 'default layer',
        layer_content = functions.LayerContent().use_local_zip_archive(
            local_file_path = './layer.zip'
        ),
        layer_runtimes = [
            functions.FunctionRuntime.Python
        ],
        layer_license = 'default license'
    )

    try:
        layer_version: int = create_operation.wait_for_done(
            max_wait_seconds = 15
        )
    except TimeoutError:
        pass
    
    if create_operation.has_done():
        print('info: layer version = {LAYER_VERSION}'.format(
            LAYER_VERSION = layer_version
        ))
    else:
        print('error: the operation did not complete successfully')

if __name__ == '__main__':
    main()
```

## 适用于

#### Tencent Cloud SDK for Python

基础软件包：tencent-cloud-sdk-core >= 0.1.5
