研究任务状态与恢复
原能力
持久保存计划、任务和实际运行,支持暂停、更正、取消、重试及按原请求恢复。(合同附件 R7 6.8)
首选项目
Temporal Python SDK(MIT,限 SDK)。 Temporal Python SDK
匹配范围
持久 Workflow ID、Signal、重试与历史恢复。
源码
Temporal Python SDK · def get_workflow_handle(
temporalio/client/_client.py · 868–881 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def get_workflow_handle(
self,
workflow_id: str,
*,
run_id: str | None = None,
first_execution_run_id: str | None = None,
result_type: type | None = None,
) -> WorkflowHandle[Any, Any]:
"""Get a workflow handle to an existing workflow by its ID.
Args:
workflow_id: Workflow ID to get a handle to.
run_id: Run ID that will be used for all calls.
first_execution_run_id: First execution run ID used for cancellation
Temporal Python SDK · class RetryPolicy
temporalio/common.py · 37–50 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
class RetryPolicy:
"""Options for retrying workflows and activities."""
initial_interval: timedelta = timedelta(seconds=1)
"""Backoff interval for the first retry. Default 1s."""
backoff_coefficient: float = 2.0
"""Coefficient to multiply previous backoff interval by to get new
interval. Default 2.0.
"""
maximum_interval: timedelta | None = None
"""Maximum backoff interval between retries. Default 100x
:py:attr:`initial_interval`.
实现与验收要点
研究业务状态协议、原请求复用、取消与更正互斥。