-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add batchsize
in blob triggered Azure Function
#10624
Comments
Can you share more about the function? Which language/stack? Extension version? Host version? The process may vary depending on this information, but in general, you need to set batchSize to 1, and newBatchThreshold to 0.
It's also worth noting that there is a newer eventGrid based approach to blob triggers that is better to use: |
host: 2.0
I can share any other specific information that may be required but I may not be able to share the entire code. |
Thanks, and did the guidance I shared not work for you? |
@liliankasem I tried what you suggested: but as you can see here all files are read. |
Okay I was able to get this working with the following setup - can you give this a shot? host.json{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensions": {
"blobs": {
"maxDegreeOfParallelism": 1
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[4.*, 5.0.0)"
}
} function_app.pyimport azure.functions as func
import datetime
import json
import logging
from time import sleep
app = func.FunctionApp(http_auth_level=func.AuthLevel.ANONYMOUS)
@app.blob_trigger(arg_name="myblob", path="samples-workitems/{name}", connection="BlobStorageConnectionString")
def BlobTrigger(myblob: func.InputStream):
logging.info(f"Python blob trigger function processed blob. Now sleeping for 10 seconds")
sleep(10)
logging.warn(f"Name: {myblob.name} | Blob Size: {myblob.length} bytes") PortalApp SettingsAll the usual settings with the addition of:
Scale OutSet scale out to 1: ResultsI uploaded a bunch of files at the same time: And I can see the blob trigger processing them one at a time: |
To prevent race conditions and exceed the 1.5 GB memory limit, I would like the BlobTrigger to process only 1 file at a time.
host.json
The deployment for the above is in AKS.
I tried "How to ensure only one Azure Function BlobTrigger runs at a time?", but that also does not seem to be working.
The text was updated successfully, but these errors were encountered: