Comments (9)
I'm wondering the same as I would like to have client = df.DurableOrchestrationClient(starter)
as Global Dependency in FastAPI. So that we can use durable functions Orchestrator but called from regular FastAPI endpoints.
Here is an example with a custom orchestration status, but again needs the starter: str
https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-custom-orchestration-status?tabs=python#e1_sayhello-activity-function
For the sake of it starter
in v1 is:
{
"taskHubName": "TestHubName",
"connectionName": null,
"creationUrls": {
"createNewInstancePostUri": "http://localhost:7071/runtime/webhooks/durabletask/orchestrators/{functionName}[/{instanceId}]?code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"createAndWaitOnNewInstancePostUri": "http://localhost:7071/runtime/webhooks/durabletask/orchestrators/{functionName}[/{instanceId}]?timeout={timeoutInSeconds}&pollingInterval={intervalInSeconds}&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ=="
},
"managementUrls": {
"id": "INSTANCEID",
"statusQueryGetUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID?taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"sendEventPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID/raiseEvent/{eventName}?taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"terminatePostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID/terminate?reason={text}&taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"rewindPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID/rewind?reason={text}&taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"purgeHistoryDeleteUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID?taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"restartPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID/restart?taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"suspendPostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID/suspend?reason={text}&taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"resumePostUri": "http://localhost:7071/runtime/webhooks/durabletask/instances/INSTANCEID/resume?reason={text}&taskHub=TestHubName&connection=Storage&code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ=="
},
"baseUrl": "http://localhost:7071/runtime/webhooks/durabletask",
"requiredQueryStringParameters": "code=fMKqfur7tU1yidXikGCwP_z560dXaMhnKGsMy3RYd-bpAzFu1fnKRQ==",
"rpcBaseUrl": "http://127.0.0.1:17071/durabletask/"
}
from azure-functions-durable-python.
I think I've found a way for v2 with
generic_input_binding
Thanks for replying and sharing this solution. I will try your soultion next week :)
from azure-functions-durable-python.
Hi @AndreRicardo-Zoetis, @crypto-ralph - thank you for using Durable Functions! I'm a PM working on DF and would love to learn about your experience using the product. You can share your feedback in this quick survey to help influence what the team works on next. If you're building intelligent apps, there's also an opportunity to participate in a compensated UX study. Thanks!
from azure-functions-durable-python.
I'm particulary interested in equivalent of example "Client signals an entity" from this page:
https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-entities?tabs=function-based%2Cin-process&pivots=python#access-entities
from azure-functions-durable-python.
@davidmrdavid would you be able to help? Since you seem to be the author for the decorator that gets the starter = kwargs[parameter_name]
?
from azure-functions-durable-python.
I think I've found a way for v2 with generic_input_binding
app = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
# An HTTP-Triggered Function with a Durable Functions Client binding
@app.route(route="bind/")
@app.generic_input_binding(arg_name="starter", type="durableClient")
async def mybind(req: func.HttpRequest, starter):
return starter
from azure-functions-durable-python.
I think I've found a way for v2 with
generic_input_binding
Thanks for replying and sharing this solution. I will try your soultion next week :)
I've tested it locally with a v2 function app
Note how there is no function.json
from azure-functions-durable-python.
I've tested it locally with a v2 function app
I confirm that this solution works also in my case.
@AndreRicardo-Zoetis do you have any doc reference for this input binding?
I would be glad if someone from the dev team confirm that this is recommended approach as I need to introduce it in production ready system.
from azure-functions-durable-python.
I've tested it locally with a v2 function app
I confirm that this solution works also in my case. @AndreRicardo-Zoetis do you have any doc reference for this input binding?
I would be glad if someone from the dev team confirm that this is recommended approach as I need to introduce it in production ready system.
No doc reference, I was just going through code in azure-functions-durable-python until I arrived here:
For context, I was trying to find a way around #444 to call the Orchestration from FastAPI.
The code for the generic_input_binding
is here:
https://github.com/Azure/azure-functions-python-library/blob/0ca53b35491ce22569f012d485c9973050ea3227/azure/functions/decorators/function_app.py#L2180
I believe I've seen first usage in this repo:
https://github.com/search?q=repo%3AAzure%2Fazure-functions-python-worker%20generic_input_binding&type=code
I was just trying to map a way from v1 to v2, because in v1 in someway is more explicit to understand where this starter
comes from.
from azure-functions-durable-python.
Related Issues (20)
- Durable Function Error when accessing Blob Storage behind Private Endpoint HOT 2
- Events added to in-memory queue are not being removed after wait_for_external_event consumes it HOT 4
- Routing/URL matching precedence is ignored
- How to properly pass input arguments to a sub-orchestration function?
- Known regression: Activity input fails to deserialize when the input is an array
- Add call_activity_with_retry to DurableOrchestrationContext class
- Object of type generator is not JSON serializable error in orchestrator function
- Please support the underscore character as a binding name
- [SURVEY] Share your experience to influence what Durable works on next!
- Ability to access 'classic' Azure Function Context, so that I can trace against the same operation_Id
- Dependency injection in Python Azure Functions HOT 1
- Errors in Activity Functions cannot be handled using try...except HOT 2
- context.signal_entity causes sub orchestrator to never finish. HOT 5
- Parameter names using snake_case cause failure HOT 6
- Typing function parameters for activities etc. causes failure HOT 2
- get_status(instance_id) - runtime_status is not up to date HOT 4
- Error "ImportError: cannot import name 'packaging' from 'pkg_resources'" HOT 2
- To fix MEND issue by updating the requirements.txt HOT 1
- Known issue with hosting Durable Functions app on preview Flex Consumption plan
- Single event notification is being yielded every time with `wait_for_external_event` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-functions-durable-python.