和顺 / 势衡 返回所属 Agent
SH-08.01

可逆试行与退出

原能力

给试行设置继续、暂停、回退或终止条件,记录不可逆承诺需经谁确认。(细化版 p.8–9)

首选项目

Temporal Python SDK(MIT,限 SDK)。 Temporal Python SDK

匹配范围

持久流程的取消、等待和补偿编排。

源码

Temporal Python SDK · async def cancel(

temporalio/client/_workflow.py · 326–339 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    async def cancel(
        self,
        *,
        reason: str = "",
        rpc_metadata: Mapping[str, str | bytes] = {},
        rpc_timeout: timedelta | None = None,
    ) -> None:
        """Cancel the workflow.

        This will issue a cancellation for :py:attr:`run_id` if present. This
        call will make sure to use the run chain starting from
        :py:attr:`first_execution_run_id` if present. To create handles with
        these values, use :py:meth:`Client.get_workflow_handle`.

Temporal Python SDK · async def execute_activity(

temporalio/workflow/_activities.py · 337–350 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
async def execute_activity(
    activity: CallableAsyncNoParam[ReturnType],
    *,
    task_queue: str | None = None,
    schedule_to_close_timeout: timedelta | None = None,
    schedule_to_start_timeout: timedelta | None = None,
    start_to_close_timeout: timedelta | None = None,
    heartbeat_timeout: timedelta | None = None,
    retry_policy: temporalio.common.RetryPolicy | None = None,
    cancellation_type: ActivityCancellationType = ActivityCancellationType.TRY_CANCEL,
    activity_id: str | None = None,
    versioning_intent: VersioningIntent | None = None,
    summary: str | None = None,
    event_groups: Sequence[EventGroup] | None = None,

实现与验收要点

实际可逆的技术/合同边界和有权终止条件。