设置当前可等待操作的结果,该结果可以通过访问可等待操作对象的 result
属性获得。
def set_result(self,wait_result: object)
值得注意的是,如果方法 wait_for_done
调用成功,可等待操作的结果将被覆盖。
该方法具有以下参数,其参数、参数类型和参数描述如下:
参数 | 类型 | 必选 | 描述 |
wait_result | object | 是 | 包含可等待操作结果的 Object 实例,该参数允许被设置为 |
该方法没有返回值。
该方法不会主动抛出异常。
接下来我们将通过一段 Python 代码向您演示如何使用该方法:
from tencent.cloud.core import errorsfrom tencent.cloud.core import waitablefrom tencent.cloud.serverless import functionsdef 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')create_operation.set_result(wait_result = 10)if __name__ == '__main__':main()
基础软件包:tencent-cloud-sdk-core >= 0.1.5