Update flow wrapper expected workflows and template
All checks were successful
CI Workflow / Testing the Flow (push) Successful in 15s
CI Workflow / Containerize the Flow (push) Successful in 37s

This commit is contained in:
Ankur Malik 2025-12-04 11:08:57 -05:00
parent a2b927c166
commit 9ee74f14cc
4 changed files with 90 additions and 28 deletions

View File

@ -8,6 +8,18 @@ import re
import jmespath
from temporalio.exceptions import ApplicationError
# Allow jmespath/random inside Temporal's workflow sandbox so JSONPath
# evaluation for block inputs does not get blocked as non-deterministic.
try: # pragma: no cover - sandbox config
from temporalio.worker import workflow_sandbox
# jmespath internally uses random.sample; both need to be allowed.
workflow_sandbox.allow_import("jmespath")
workflow_sandbox.allow_import("random")
except Exception:
# On older temporalio versions or outside worker context, this is a no-op.
pass
# Configure logging
logging.basicConfig(level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s")
@ -38,6 +50,7 @@ class test_repo_test_branch_1234567890:
# Prepare inputs
input_params: Dict[str, Any] = {}
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("a")
value = jsonpath_expr.search(root_inputs)
input_params["a"] = value
@ -45,6 +58,7 @@ class test_repo_test_branch_1234567890:
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
input_params["a"] = None
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("b")
value = jsonpath_expr.search(root_inputs)
input_params["b"] = value
@ -110,6 +124,7 @@ class test_repo_test_branch_1234567890:
input_params: Dict[str, Any] = {}
try:
source_data = results.get("2", {})
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("sum")
value = jsonpath_expr.search(source_data)
input_params["sum"] = value
@ -175,6 +190,7 @@ class test_repo_test_branch_1234567890:
input_params: Dict[str, Any] = {}
try:
source_data = results.get("2", {})
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("sum")
value = jsonpath_expr.search(source_data)
input_params["product"] = value

View File

@ -8,6 +8,18 @@ import re
import jmespath
from temporalio.exceptions import ApplicationError
# Allow jmespath/random inside Temporal's workflow sandbox so JSONPath
# evaluation for block inputs does not get blocked as non-deterministic.
try: # pragma: no cover - sandbox config
from temporalio.worker import workflow_sandbox
# jmespath internally uses random.sample; both need to be allowed.
workflow_sandbox.allow_import("jmespath")
workflow_sandbox.allow_import("random")
except Exception:
# On older temporalio versions or outside worker context, this is a no-op.
pass
# Configure logging
logging.basicConfig(level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s")
@ -38,6 +50,7 @@ class test_repo_test_branch_1234567890:
# Prepare inputs
input_params: Dict[str, Any] = {}
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("a")
value = jsonpath_expr.search(root_inputs)
input_params["a"] = value
@ -45,6 +58,7 @@ class test_repo_test_branch_1234567890:
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
input_params["a"] = None
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("b")
value = jsonpath_expr.search(root_inputs)
input_params["b"] = value
@ -109,6 +123,7 @@ class test_repo_test_branch_1234567890:
# Prepare inputs
input_params: Dict[str, Any] = {}
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("sum")
value = jsonpath_expr.search(root_inputs)
input_params["sum"] = value
@ -173,6 +188,7 @@ class test_repo_test_branch_1234567890:
# Prepare inputs
input_params: Dict[str, Any] = {}
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("product")
value = jsonpath_expr.search(root_inputs)
input_params["product"] = value

View File

@ -8,6 +8,18 @@ import re
import jmespath
from temporalio.exceptions import ApplicationError
# Allow jmespath/random inside Temporal's workflow sandbox so JSONPath
# evaluation for block inputs does not get blocked as non-deterministic.
try: # pragma: no cover - sandbox config
from temporalio.worker import workflow_sandbox
# jmespath internally uses random.sample; both need to be allowed.
workflow_sandbox.allow_import("jmespath")
workflow_sandbox.allow_import("random")
except Exception:
# On older temporalio versions or outside worker context, this is a no-op.
pass
# Configure logging
logging.basicConfig(level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s")
@ -38,6 +50,7 @@ class test_repo_test_branch_1234567890:
# Prepare inputs
input_params: Dict[str, Any] = {}
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("a")
value = jsonpath_expr.search(root_inputs)
input_params["a"] = value
@ -45,6 +58,7 @@ class test_repo_test_branch_1234567890:
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
input_params["a"] = None
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("b")
value = jsonpath_expr.search(root_inputs)
input_params["b"] = value
@ -110,6 +124,7 @@ class test_repo_test_branch_1234567890:
input_params: Dict[str, Any] = {}
try:
source_data = results.get("2", {})
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("sum")
value = jsonpath_expr.search(source_data)
input_params["sum"] = value
@ -175,6 +190,7 @@ class test_repo_test_branch_1234567890:
input_params: Dict[str, Any] = {}
try:
source_data = results.get("m3aiq7ixuo6du35h8tr", {})
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("product")
value = jsonpath_expr.search(source_data)
input_params["product"] = value

View File

@ -8,6 +8,18 @@ import re
import jmespath
from temporalio.exceptions import ApplicationError
# Allow jmespath/random inside Temporal's workflow sandbox so JSONPath
# evaluation for block inputs does not get blocked as non-deterministic.
try: # pragma: no cover - sandbox config
from temporalio.worker import workflow_sandbox
# jmespath internally uses random.sample; both need to be allowed.
workflow_sandbox.allow_import("jmespath")
workflow_sandbox.allow_import("random")
except Exception:
# On older temporalio versions or outside worker context, this is a no-op.
pass
# Configure logging
logging.basicConfig(level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s")
@ -52,6 +64,7 @@ class {{ workflow_class_name }}:
{%- set source = details.get("source", "") %}
{%- if source and source.startswith("$root.") %}
try:
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("{{ source[6:] }}")
value = jsonpath_expr.search(root_inputs)
input_params["{{ param }}"] = value
@ -64,6 +77,7 @@ class {{ workflow_class_name }}:
{%- set source_path = source_parts[1] if source_parts|length > 1 else '' %}
try:
source_data = results.get("{{ source_node_id }}", {})
with temporalio.workflow.unsafe.sandbox_unrestricted():
jsonpath_expr = jmespath.compile("{{ source_path }}")
value = jsonpath_expr.search(source_data)
input_params["{{ param }}"] = value