Azure/azure-functions-durable-python

Add support for Durable Entities

Closed this issue Β· 14 comments

Would you like to see Durable Entities supported in Python? Let us know here! If possible, include details about how you plan on using them. Thanks!

I'm hoping to use durable entities for a simple heartbeat monitor of IoT devices - heartbeat messages would get routed to a service bus queue, which triggers the durable function to save the device info and heartbeat timestamp and check against the age of the last heartbeat received.

I built something now that uses events in a orchestrator but that should be using a entity to understand where it is and what's happening, that would also allow more complex patterns, with the entity being updated, running some activities at different points for different states etc.

We use durable entities simply to count the number of activities called during the durable function execution. This is preventing us from migrating the .net c# durable function to python durable function.

Great! The work to add entities to Python is well underway! @davidmrdavid

@asipras , oh I have some good news for y'all then πŸ˜„

Indeed, Durable Entities for Python are coming and they appear to be working on my local branch. I'm actually expecting to open a PR for those today, although I still need to incorporate a few unit tests for them. Regardless, I believe you can expect them becoming available in the very near future! ⚑ ⚑

JosXa commented

Nice work, I am used to having durable entities available in C# by now and I'm just adding my voice here without a real use case other than "I really want to play around and see what I can do with them in PythonπŸš€"! Glad to hear it's coming soon!

Any news or ways we can contribute to make this possible?

@aminekaabachi The Durable Entities PR already exists and has been ready for some time now here: #184

We're just waiting for an azure functions python worker release to take place for that to get merged and shipped asap. That worker contains some lower-level changes necessary for the Entities PR to actually run. Unfortunately, for stability reasons, that worker release schedule is currently much slower than ours.

The good news is that the worker is already in the process of releasing and I understand that it should be available in a matter of weeks now. Sorry this has taken so long, I also can't wait to finally merge this and get it out the door!

I'll continue updating this post with updates! Thank you for your interest and your patience ⚑ ⚑

Released!

I'm using VSCode attached to a local container image (mcr.microsoft.com/azure-functions/python:3.0-python3.8-core-tools) In there I have installed azure-functions-core-tools-3 (3.0.3233-1) and in the IDE I have the extension ms-azuretools.vscode-azurefunctions v1.1.0.
When I try to create a new Durable Function it lists only Activity, Orchestrator and Starter type of functions.

I understand the azure-functions-core-tools-3 is responsible for providing the list of available durable functions in the VSCode menu and Iassume that this has not been updated yet to include the Durable Entities.
Using intellisense I can see the DurableEntityContext and other related classes, is there any documentation to guide on the use of Python entity functions?
Thanks

I think that the counter_entity sample will help you getting started with durable entities:
https://github.com/Azure/azure-functions-durable-python/tree/dev/samples/counter_entity

Thanks for the suggestion @martijnlentink!
Hi @gromag, if you update your extension bundles to be in the V2 range, as in here: https://github.com/Azure/azure-functions-durable-python/blob/dev/samples/fan_in_fan_out/host.json
then you should be able to see the entity templates in VSCode, assuming you have the latest update of core-tools.

Also, we have documentation pages for entities on the way! They're just not public yet, but I'm happy to help with any issues you have if you open a new ticket :) . Thanks!

Thank you @davidmrdavid, although I had the latest extension bundle and core-tools it did not show in the list until I changed the Azure Function template filter from "Verified" to "All", It is in the menu now! πŸ˜…

Hi @gromag, glad to hear you were finally able to see them. Strange that they were not under "verified" though.
I'll ask around to see if others encounter this problem as well. If you encounter any more issues with entities, feel free to raise them in a new ticket and I'll address them asap!