跳转至

backend.context.task_action

task_action

类:

名称 描述
Task
Action

函数:

名称 描述
task

task 装饰器,用于标记一个函数为任务函数。

Task dataclass

属性:

名称 类型 描述
priority int

任务优先级,数字越大优先级越高。

priority instance-attribute

priority: int

任务优先级,数字越大优先级越高。

Action dataclass

属性:

名称 类型 描述
priority int

动作优先级,数字越大优先级越高。

priority instance-attribute

priority: int

动作优先级,数字越大优先级越高。

task

task(name: str, task_id: str | None = None, description: str | None = None, *, pass_through: bool = False, priority: int = 0, screenshot_mode: ScreenshotMode = 'auto', run_at: TaskRunAtType = 'regular')

task 装饰器,用于标记一个函数为任务函数。

参数:

名称 类型 描述 默认

name

str

任务名称

必需

task_id

str | None

任务 ID。如果为 None,则使用函数名称作为 ID。

None

description

str | None

任务描述。如果为 None,则使用函数的 docstring 作为描述。

None

pass_through

bool

默认情况下, @task 装饰器会包裹任务函数,跟踪其执行情况。 如果不想跟踪,则设置此参数为 False。

False

priority

int

任务优先级,数字越大优先级越高。

0

run_at

TaskRunAtType

任务运行时间。

'regular'