I am trying to use Durable Functions in Python and I want to store the state in a Durable Entity. There is very little documentation on how to work with Durable Entities, especially in Python. I have even tried to read some C# code, but it hasn't helped much. The only example they provide is a simple "Counter" function that is called from the Client function, but I want to call it from the Orchestrator function. The only documentation I can find is here:
This guide says I can do it from the orchestrator, and here is the example they provide:
def orchestrator_function(context: df.DurableOrchestrationContext):
entityId = df.EntityId("Counter", "myCounter")
current_value = yield context.call_entity(entityId, "get")
if current_value < 10:
context.signal_entity(entityId, "add", 1)
return state
So following that documentation gives me the following error:
Exception: RuntimeError: function 'DurableFunctionsEntityPy' without a $return binding returned a non-None value
I have tried using various outputs in the function.json for the Entity Function, but none work. Most of the time I get an error that says:
@durablefunctionsentitypy@myCounter: Function 'durablefunctionsentitypy (Entity)' failed with an error. Reason: Internal error: System.ArgumentNullException: Value cannot be null. (Parameter 'name')
What needs to go here?
I'm also very confused by the "return state" part of the code? Where is "state" ever defined? It just seems like they threw that in there without showing any way for someone to figure it out. I wish Microsoft spent a little more time working through these guides so they made sense!
Please help, I'm pulling my hair out!