chore: [workflow] 提交工作区代码

This commit is contained in:
wangyunlong committed 2026-09-30 10:46:15 +08:00
1 parent 2ff588a65d
commit 01f3d7aaf7
131 files changed
+24306 -1320

No files matched your search

+5 -1
View File
@@ -228,7 +228,11 @@ class WorkflowEngine:
with ExitStack() as stack:
for resource in sorted(step.resources):
stack.enter_context(
self._lock_manager.acquire(resource, owner=context.run_id)
self._lock_manager.acquire(
resource,
owner=context.run_id,
timeout_seconds=step.resource_lock_timeout_seconds,
)
)
action_started = True
outcome = step.action.execute(
+2
View File
@@ -31,6 +31,7 @@ def build_catalog_workflow(
official_notification: bool = False,
independent_step_resources: bool = False,
default_replay_policy: str = "guarded",
resource_lock_timeout_seconds: float = 30.0,
) -> WorkflowDefinition:
"""Build one executable graph without adding one class per business task."""
@@ -72,6 +73,7 @@ def build_catalog_workflow(
),
max_attempts=1,
resources=step_resources,
resource_lock_timeout_seconds=resource_lock_timeout_seconds,
production_sink=True,
official_notification=official_notification,
replay_policy=(
+11
View File
@@ -55,6 +55,7 @@ class StepDefinition:
official_notification: bool = False
replay_policy: ReplayPolicy = "guarded"
run_after_failure: bool = False
resource_lock_timeout_seconds: float = 30.0
def __post_init__(self) -> None:
object.__setattr__(self, "depends_on", tuple(self.depends_on))
@@ -81,6 +82,16 @@ class StepDefinition:
raise WorkflowValidationError(
f"timeout_seconds must be positive for step {self.step_id!r}"
)
if (
isinstance(self.resource_lock_timeout_seconds, bool)
or not isinstance(self.resource_lock_timeout_seconds, (int, float))
or not math.isfinite(self.resource_lock_timeout_seconds)
or self.resource_lock_timeout_seconds <= 0
):
raise WorkflowValidationError(
"resource_lock_timeout_seconds must be positive for step "
f"{self.step_id!r}"
)
if (
isinstance(self.max_attempts, bool)
or not isinstance(self.max_attempts, int)