Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
336 stars 104 forks source link

Add V2 samples in docs for missing Triggers/bindings #1261

Open pdthummar opened 1 year ago

pdthummar commented 1 year ago

Docs update needed for following triggers/bindings: Table Warmup Trigger SB Queue Output

### Tasks
- [ ] Retry Policy Examples for ProgModelv2
- [ ] WarmUp Trigger Examples for ProgModelv2
- [ ] Table Storage Trigger Examples for ProgModelv2
- [ ] SB Queue Output Binding Examples for ProgModelv2
- [ ] Dapr Examples for ProgModelv2 (to check with Dapr Team
vrdmr commented 1 year ago

EventGrid examples

nvablaest commented 1 year ago

Warmup Trigger example would be helpfull

vrdmr commented 1 year ago

warmup_trigger

sudharsan2020 commented 1 year ago

@vrdmr Can you please suggest how can I add a warmup function for Azure Functions V2 with Service Bus Trigger. We are implementing a unified health check for all the Azure Functions.

I am expecting something like this:

image

pdthummar commented 1 year ago

@sudharsan2020 there may only be one warmup function per app. You can create a single warmup function as shown below, and then create separate functions for your service bus triggers. Thanks

import azure.functions as func
import logging

app = func.FunctionApp()

@app.warm_up_trigger('warmup')
def warmup(warmup) -> None:
    logging.info('Function App instance is warm')
sudharsan2020 commented 1 year ago

@pdthummar How do I trigger the warmup function. I didn't see any sufficient documentation on this. We are required to do a health check of our Azure function across multiple regions on a periodic basis

pdthummar commented 1 year ago

@sudharsan2020 A warmup trigger is invoked when an instance is added to scale a running function app. The warmup trigger lets you define a function that's run when a new instance of your function app is started.

For more info, please refer: Azure Functions warmup trigger Thanks

Marsharks commented 7 months ago

@sudharsan2020 there may only be one warmup function per app. You can create a single warmup function as shown below, and then create separate functions for your service bus triggers. Thanks

import azure.functions as func
import logging

app = func.FunctionApp()

@app.warm_up_trigger('warmup')
def warmup(warmup) -> None:
    logging.info('Function App instance is warm')

When testing in Azure, I get System.NotImplementedException at Microsoft.Azure.WebJobs.Host.Bindings.TriggerAdapterBindingProvider`2+ExactBinding+d__10.MoveNext