Object of type generator is not JSON serializable error in orchestrator function
ravihooda155 opened this issue · comments
In order to reuse piece of code within orchestrator function .Added below code for testing that part.
The behaviour of activity trigger part change when it is used in separate function other than orchestrator function.
It throws error Object of type generator is not JSON serializable error when used in some other test function and test function is used in orchestrator function.
It works fine when yield part is within orchestrator function
IS this the right way of implementing the usage of repetitive code in orchestrator function or we need sub orchestrators etc ?
def test(context: df.DurableOrchestrationContext,args):
response = yield context.call_activity('hello', args)
logging.info(response)
return response
def orchestrator_function(context: df.DurableOrchestrationContext):
response = yield context.call_activity('hello', args)
logging.info(response)
orchestrator_response =test(context,args)
logging.info(orchestrator_response)
Hello is activity trigger return following dict
{'result': 'failure', 'response': 'Something went wrong.Internal server error', 'status_code': 500}
2024-02-26 11:40:28.312
{'result': 'failure', 'response': 'Something went wrong.Internal server error', 'status_code': 500}
Information
2024-02-26 11:40:28.312
<generator object test at 0x7ff2806fe500>
Information
2024-02-26 11:40:28.379
f1464adb297b452684b7b510dafc84f6: Function '_orchestrator (Orchestrator)' failed with an error. Reason: Message: Object of type generator is not JSON serializable, StackTrace: at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task
1.get_Result() at Microsoft.Azure.WebJobs.Extensions.DurableTask.TaskOrchestrationShim.InvokeUserCodeAndHandleResults(RegisteredFunctionInfo orchestratorInfo, OrchestrationContext innerContext) in D:\a_work\1\s\src\WebJobs.Extensions.DurableTask\Listener\TaskOrchestrationShim.cs:line 150. IsReplay: False. State: Failed. RuntimeStatus: Failed. HubName: . AppName: . SlotName: Production. ExtensionVersion: 2.12.0. SequenceNumber: 5. TaskEventId: -1