no need to sanitize cache_key (#3675)
This commit is contained in:
@@ -441,6 +441,7 @@ def _action_to_stmt(act: dict[str, Any], task: dict[str, Any], assign_to_output:
|
|||||||
|
|
||||||
def _build_block_fn(block: dict[str, Any], actions: list[dict[str, Any]]) -> FunctionDef:
|
def _build_block_fn(block: dict[str, Any], actions: list[dict[str, Any]]) -> FunctionDef:
|
||||||
name = _safe_name(block.get("label") or block.get("title") or f"block_{block.get('workflow_run_block_id')}")
|
name = _safe_name(block.get("label") or block.get("title") or f"block_{block.get('workflow_run_block_id')}")
|
||||||
|
cache_key = block.get("label") or block.get("title") or f"block_{block.get('workflow_run_block_id')}"
|
||||||
body_stmts: list[cst.BaseStatement] = []
|
body_stmts: list[cst.BaseStatement] = []
|
||||||
is_extraction_block = block.get("block_type") == "extraction"
|
is_extraction_block = block.get("block_type") == "extraction"
|
||||||
|
|
||||||
@@ -473,7 +474,7 @@ def _build_block_fn(block: dict[str, Any], actions: list[dict[str, Any]]) -> Fun
|
|||||||
Param(name=Name("context"), annotation=cst.Annotation(cst.Name("RunContext"))),
|
Param(name=Name("context"), annotation=cst.Annotation(cst.Name("RunContext"))),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
decorators=[_make_decorator(name, block)],
|
decorators=[_make_decorator(cache_key, block)],
|
||||||
body=cst.IndentedBlock(body_stmts),
|
body=cst.IndentedBlock(body_stmts),
|
||||||
returns=None,
|
returns=None,
|
||||||
asynchronous=cst.Asynchronous(),
|
asynchronous=cst.Asynchronous(),
|
||||||
@@ -482,6 +483,7 @@ def _build_block_fn(block: dict[str, Any], actions: list[dict[str, Any]]) -> Fun
|
|||||||
|
|
||||||
def _build_task_v2_block_fn(block: dict[str, Any], child_blocks: list[dict[str, Any]]) -> FunctionDef:
|
def _build_task_v2_block_fn(block: dict[str, Any], child_blocks: list[dict[str, Any]]) -> FunctionDef:
|
||||||
"""Build a cached function for task_v2 blocks that calls child workflow sub-tasks."""
|
"""Build a cached function for task_v2 blocks that calls child workflow sub-tasks."""
|
||||||
|
cache_key = block.get("label") or block.get("title") or f"block_{block.get('workflow_run_block_id')}"
|
||||||
name = _safe_name(block.get("label") or block.get("title") or f"block_{block.get('workflow_run_block_id')}")
|
name = _safe_name(block.get("label") or block.get("title") or f"block_{block.get('workflow_run_block_id')}")
|
||||||
body_stmts: list[cst.BaseStatement] = []
|
body_stmts: list[cst.BaseStatement] = []
|
||||||
|
|
||||||
@@ -501,7 +503,7 @@ def _build_task_v2_block_fn(block: dict[str, Any], child_blocks: list[dict[str,
|
|||||||
Param(name=Name("context"), annotation=cst.Annotation(cst.Name("RunContext"))),
|
Param(name=Name("context"), annotation=cst.Annotation(cst.Name("RunContext"))),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
decorators=[_make_decorator(name, block)],
|
decorators=[_make_decorator(cache_key, block)],
|
||||||
body=cst.IndentedBlock(body_stmts),
|
body=cst.IndentedBlock(body_stmts),
|
||||||
returns=None,
|
returns=None,
|
||||||
asynchronous=cst.Asynchronous(),
|
asynchronous=cst.Asynchronous(),
|
||||||
|
|||||||
Reference in New Issue
Block a user