From 5c3cc08690c3338b355f8b9a13b92a863c8e5375 Mon Sep 17 00:00:00 2001 From: Naiyuan Tian <110135109+nytian@users.noreply.github.com> Date: Mon, 15 Apr 2024 23:06:46 -0700 Subject: [PATCH 1/4] initial commit --- .../models/TaskOrchestrationExecutor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/azure/durable_functions/models/TaskOrchestrationExecutor.py b/azure/durable_functions/models/TaskOrchestrationExecutor.py index 66389935..48a3fd5d 100644 --- a/azure/durable_functions/models/TaskOrchestrationExecutor.py +++ b/azure/durable_functions/models/TaskOrchestrationExecutor.py @@ -276,6 +276,16 @@ def get_orchestrator_state_str(self) -> str: message contains in it the string representation of the orchestration's state """ + if(self.output): + try: + # Attempt to serialize the output. If serialization fails, raise an + # error indicating that the orchestration output is not serializable, + # which is not permitted in durable Python functions. + json.dumps(self.output) + except Exception as e: + self.output = None + self.exception = e + state = OrchestratorState( is_done=self.orchestration_invocation_succeeded, actions=self.context._actions, From e9dbf82c87902c0c3f13bc2ca59dc108296be34c Mon Sep 17 00:00:00 2001 From: Naiyuan Tian <110135109+nytian@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:27:41 -0700 Subject: [PATCH 2/4] remove blank line --- azure/durable_functions/models/TaskOrchestrationExecutor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/durable_functions/models/TaskOrchestrationExecutor.py b/azure/durable_functions/models/TaskOrchestrationExecutor.py index 48a3fd5d..6417e306 100644 --- a/azure/durable_functions/models/TaskOrchestrationExecutor.py +++ b/azure/durable_functions/models/TaskOrchestrationExecutor.py @@ -285,7 +285,7 @@ def get_orchestrator_state_str(self) -> str: except Exception as e: self.output = None self.exception = e - + state = OrchestratorState( is_done=self.orchestration_invocation_succeeded, actions=self.context._actions, From 4c5e90c38ea89baa3b4eeddcbdda8f1ea9a825df Mon Sep 17 00:00:00 2001 From: Naiyuan Tian <110135109+nytian@users.noreply.github.com> Date: Tue, 16 Apr 2024 21:55:12 -0700 Subject: [PATCH 3/4] Remove unused pkg --- azure/durable_functions/models/OrchestratorState.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/durable_functions/models/OrchestratorState.py b/azure/durable_functions/models/OrchestratorState.py index abf09a74..7b426292 100644 --- a/azure/durable_functions/models/OrchestratorState.py +++ b/azure/durable_functions/models/OrchestratorState.py @@ -1,5 +1,5 @@ import json -from typing import List, Any, Dict, Optional, Union +from typing import List, Any, Dict, Optional from azure.durable_functions.models.ReplaySchema import ReplaySchema From 987a2de7d41d4d27cd23cdb9d2ea7e9ec2d86fff Mon Sep 17 00:00:00 2001 From: Naiyuan Tian <110135109+nytian@users.noreply.github.com> Date: Mon, 29 Apr 2024 19:57:28 -0700 Subject: [PATCH 4/4] update by comments --- azure/durable_functions/models/TaskOrchestrationExecutor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/durable_functions/models/TaskOrchestrationExecutor.py b/azure/durable_functions/models/TaskOrchestrationExecutor.py index 6417e306..5cfc0b5f 100644 --- a/azure/durable_functions/models/TaskOrchestrationExecutor.py +++ b/azure/durable_functions/models/TaskOrchestrationExecutor.py @@ -276,7 +276,7 @@ def get_orchestrator_state_str(self) -> str: message contains in it the string representation of the orchestration's state """ - if(self.output): + if(self.output is not None): try: # Attempt to serialize the output. If serialization fails, raise an # error indicating that the orchestration output is not serializable,