Skip to content

Commit 3f0e168

Browse files
authored
Update Orchestration Ouput Return error (#493)
* initial commit * remove blank line * Remove unused pkg * update by comments
1 parent e7cb43d commit 3f0e168

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

azure/durable_functions/models/OrchestratorState.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import json
2-
from typing import List, Any, Dict, Optional, Union
2+
from typing import List, Any, Dict, Optional
33

44
from azure.durable_functions.models.ReplaySchema import ReplaySchema
55

azure/durable_functions/models/TaskOrchestrationExecutor.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,16 @@ def get_orchestrator_state_str(self) -> str:
276276
message contains in it the string representation of the orchestration's
277277
state
278278
"""
279+
if(self.output is not None):
280+
try:
281+
# Attempt to serialize the output. If serialization fails, raise an
282+
# error indicating that the orchestration output is not serializable,
283+
# which is not permitted in durable Python functions.
284+
json.dumps(self.output)
285+
except Exception as e:
286+
self.output = None
287+
self.exception = e
288+
279289
state = OrchestratorState(
280290
is_done=self.orchestration_invocation_succeeded,
281291
actions=self.context._actions,

0 commit comments

Comments
 (0)