# run\_schedule 方法

## 简要

运行所有已创建的定时无服务器云函数调用任务，直到没有仍未调用的定时任务存在时该方法返回。这些任务通常由实例方法 [schedule\_invoke](https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/class-and-method/client/schedule-invoke) 创建。

{% hint style="danger" %}
请注意，该方法仅适用于同步编程方式，异步编程方式无需手动调用该方法。
{% endhint %}

```python
def run_schedule(self)
```

### 兼容性

该实例方法在产品软件包 tencent-cloud-sdk-serverless-functions - 0.1.2 版本中新增。如果产品软件包低于适用版本，应该使用底层级 API 模拟实现：

```python
function_client.get_event_loop().run_forever()
```

否则，已创建的定时无服务器云函数调用任务可能永远不会被运行。

## 参数

该方法没有参数。

## 返回值

该方法没有返回值。

## 异常

该方法可能会主动引发以下异常：

#### StatusError

没有已创建的定时调用任务需要运行或正在运行。

## 示例

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

```python
function_client.run_schedule()
```

## 适用于

#### Tencent Cloud SDK for Python

产品软件包：tencent-cloud-sdk-serverless-functions >= 0.1.2


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://smallso.gitbook.io/tencent-cloud-sdk/python-docs/serverless-functions/class-and-method/client/run-schedule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
