Update flow wrapper expected workflows and template
This commit is contained in:
parent
a2b927c166
commit
9ee74f14cc
@ -8,6 +8,18 @@ import re
|
|||||||
import jmespath
|
import jmespath
|
||||||
from temporalio.exceptions import ApplicationError
|
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
|
# Configure logging
|
||||||
logging.basicConfig(level=logging.INFO,
|
logging.basicConfig(level=logging.INFO,
|
||||||
format="%(asctime)s [%(levelname)s] %(message)s")
|
format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
@ -38,15 +50,17 @@ class test_repo_test_branch_1234567890:
|
|||||||
# Prepare inputs
|
# Prepare inputs
|
||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("a")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("a")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["a"] = value
|
input_params["a"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
|
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
|
||||||
input_params["a"] = None
|
input_params["a"] = None
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("b")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("b")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["b"] = value
|
input_params["b"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'b' for parameter 'b': {e}")
|
logger.error(f"Error parsing jsonpath 'b' for parameter 'b': {e}")
|
||||||
@ -110,8 +124,9 @@ class test_repo_test_branch_1234567890:
|
|||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
source_data = results.get("2", {})
|
source_data = results.get("2", {})
|
||||||
jsonpath_expr = jmespath.compile("sum")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(source_data)
|
jsonpath_expr = jmespath.compile("sum")
|
||||||
|
value = jsonpath_expr.search(source_data)
|
||||||
input_params["sum"] = value
|
input_params["sum"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'sum' for parameter 'sum' from node '2': {e}")
|
logger.error(f"Error parsing jsonpath 'sum' for parameter 'sum' from node '2': {e}")
|
||||||
@ -175,8 +190,9 @@ class test_repo_test_branch_1234567890:
|
|||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
source_data = results.get("2", {})
|
source_data = results.get("2", {})
|
||||||
jsonpath_expr = jmespath.compile("sum")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(source_data)
|
jsonpath_expr = jmespath.compile("sum")
|
||||||
|
value = jsonpath_expr.search(source_data)
|
||||||
input_params["product"] = value
|
input_params["product"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'sum' for parameter 'product' from node '2': {e}")
|
logger.error(f"Error parsing jsonpath 'sum' for parameter 'product' from node '2': {e}")
|
||||||
|
|||||||
@ -8,6 +8,18 @@ import re
|
|||||||
import jmespath
|
import jmespath
|
||||||
from temporalio.exceptions import ApplicationError
|
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
|
# Configure logging
|
||||||
logging.basicConfig(level=logging.INFO,
|
logging.basicConfig(level=logging.INFO,
|
||||||
format="%(asctime)s [%(levelname)s] %(message)s")
|
format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
@ -38,15 +50,17 @@ class test_repo_test_branch_1234567890:
|
|||||||
# Prepare inputs
|
# Prepare inputs
|
||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("a")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("a")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["a"] = value
|
input_params["a"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
|
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
|
||||||
input_params["a"] = None
|
input_params["a"] = None
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("b")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("b")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["b"] = value
|
input_params["b"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'b' for parameter 'b': {e}")
|
logger.error(f"Error parsing jsonpath 'b' for parameter 'b': {e}")
|
||||||
@ -109,8 +123,9 @@ class test_repo_test_branch_1234567890:
|
|||||||
# Prepare inputs
|
# Prepare inputs
|
||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("sum")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("sum")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["sum"] = value
|
input_params["sum"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'sum' for parameter 'sum': {e}")
|
logger.error(f"Error parsing jsonpath 'sum' for parameter 'sum': {e}")
|
||||||
@ -173,8 +188,9 @@ class test_repo_test_branch_1234567890:
|
|||||||
# Prepare inputs
|
# Prepare inputs
|
||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("product")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("product")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["product"] = value
|
input_params["product"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'product' for parameter 'product': {e}")
|
logger.error(f"Error parsing jsonpath 'product' for parameter 'product': {e}")
|
||||||
|
|||||||
@ -8,6 +8,18 @@ import re
|
|||||||
import jmespath
|
import jmespath
|
||||||
from temporalio.exceptions import ApplicationError
|
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
|
# Configure logging
|
||||||
logging.basicConfig(level=logging.INFO,
|
logging.basicConfig(level=logging.INFO,
|
||||||
format="%(asctime)s [%(levelname)s] %(message)s")
|
format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
@ -38,15 +50,17 @@ class test_repo_test_branch_1234567890:
|
|||||||
# Prepare inputs
|
# Prepare inputs
|
||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("a")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("a")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["a"] = value
|
input_params["a"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
|
logger.error(f"Error parsing jsonpath 'a' for parameter 'a': {e}")
|
||||||
input_params["a"] = None
|
input_params["a"] = None
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("b")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("b")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["b"] = value
|
input_params["b"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'b' for parameter 'b': {e}")
|
logger.error(f"Error parsing jsonpath 'b' for parameter 'b': {e}")
|
||||||
@ -110,8 +124,9 @@ class test_repo_test_branch_1234567890:
|
|||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
source_data = results.get("2", {})
|
source_data = results.get("2", {})
|
||||||
jsonpath_expr = jmespath.compile("sum")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(source_data)
|
jsonpath_expr = jmespath.compile("sum")
|
||||||
|
value = jsonpath_expr.search(source_data)
|
||||||
input_params["sum"] = value
|
input_params["sum"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'sum' for parameter 'sum' from node '2': {e}")
|
logger.error(f"Error parsing jsonpath 'sum' for parameter 'sum' from node '2': {e}")
|
||||||
@ -175,8 +190,9 @@ class test_repo_test_branch_1234567890:
|
|||||||
input_params: Dict[str, Any] = {}
|
input_params: Dict[str, Any] = {}
|
||||||
try:
|
try:
|
||||||
source_data = results.get("m3aiq7ixuo6du35h8tr", {})
|
source_data = results.get("m3aiq7ixuo6du35h8tr", {})
|
||||||
jsonpath_expr = jmespath.compile("product")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(source_data)
|
jsonpath_expr = jmespath.compile("product")
|
||||||
|
value = jsonpath_expr.search(source_data)
|
||||||
input_params["product"] = value
|
input_params["product"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath 'product' for parameter 'product' from node 'm3aiq7ixuo6du35h8tr': {e}")
|
logger.error(f"Error parsing jsonpath 'product' for parameter 'product' from node 'm3aiq7ixuo6du35h8tr': {e}")
|
||||||
|
|||||||
@ -8,6 +8,18 @@ import re
|
|||||||
import jmespath
|
import jmespath
|
||||||
from temporalio.exceptions import ApplicationError
|
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
|
# Configure logging
|
||||||
logging.basicConfig(level=logging.INFO,
|
logging.basicConfig(level=logging.INFO,
|
||||||
format="%(asctime)s [%(levelname)s] %(message)s")
|
format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
@ -52,8 +64,9 @@ class {{ workflow_class_name }}:
|
|||||||
{%- set source = details.get("source", "") %}
|
{%- set source = details.get("source", "") %}
|
||||||
{%- if source and source.startswith("$root.") %}
|
{%- if source and source.startswith("$root.") %}
|
||||||
try:
|
try:
|
||||||
jsonpath_expr = jmespath.compile("{{ source[6:] }}")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(root_inputs)
|
jsonpath_expr = jmespath.compile("{{ source[6:] }}")
|
||||||
|
value = jsonpath_expr.search(root_inputs)
|
||||||
input_params["{{ param }}"] = value
|
input_params["{{ param }}"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath '{{ source[6:] }}' for parameter '{{ param }}': {e}")
|
logger.error(f"Error parsing jsonpath '{{ source[6:] }}' for parameter '{{ param }}': {e}")
|
||||||
@ -64,8 +77,9 @@ class {{ workflow_class_name }}:
|
|||||||
{%- set source_path = source_parts[1] if source_parts|length > 1 else '' %}
|
{%- set source_path = source_parts[1] if source_parts|length > 1 else '' %}
|
||||||
try:
|
try:
|
||||||
source_data = results.get("{{ source_node_id }}", {})
|
source_data = results.get("{{ source_node_id }}", {})
|
||||||
jsonpath_expr = jmespath.compile("{{ source_path }}")
|
with temporalio.workflow.unsafe.sandbox_unrestricted():
|
||||||
value = jsonpath_expr.search(source_data)
|
jsonpath_expr = jmespath.compile("{{ source_path }}")
|
||||||
|
value = jsonpath_expr.search(source_data)
|
||||||
input_params["{{ param }}"] = value
|
input_params["{{ param }}"] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error parsing jsonpath '{{ source_path }}' for parameter '{{ param }}' from node '{{ source_node_id }}': {e}")
|
logger.error(f"Error parsing jsonpath '{{ source_path }}' for parameter '{{ param }}' from node '{{ source_node_id }}': {e}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user