In a previous discussion thread (How to output multiple blobs from an Azure Function?) it was explained to me how to use imperative binding to output multiple blobs from a single Azure Function invocation. I have had partial success with that approach, and need guidance on diagnosing this problem. My function triggers on a blob, processes it, and generates multiple output blobs. Basically it is partitioning a big data table by date.
When I trigger it with a small blob (8K) it works fine. When I process a bigger blob (2M), all the logging in the Function indicates that it was successful, but the function monitor blade shows that it failed:
Failure: The operation was canceled.
Again, the Function log has all my logging and no errors.
The invocation that succeeded took 1785ms.
The invocation that failed multiple entries in the invocation log (I assume because the blog didn't get marked as processed). Their times are all around 12,000ms. That time is well within the five minute limit for a function.
I assume that I've hit some limit with imperative binding timing out. I am seeking guidance on how to diagnose and resolve this problem. The files I actually have to process are up to 20M so will take even longer to process but would still be under 5 minutes.
function.json:
{
"bindings": [
{
"name": "myBlob",
"type": "blobTrigger",
"direction": "in",
"path": "dms/{blobname}",
"connection": "deal2_STORAGE"
},
{
"type": "queue",
"name": "emailQueueItem",
"queueName": "emailqueue",
"connection": "deal2_STORAGE",
"direction": "out"
}
],
"disabled": false
}
run.csx
public static async Task Run(Stream myBlob, string blobname, IAsyncCollector<string> emailQueueItem, Binder binder, TraceWriter log)
{
...
try {
...
foreach (var dt in dates) {
blobPath = $"json/{fileNamePart}_{dateString}";
var attributes = new Attribute[] {
new BlobAttribute(blobPath),
new StorageAccountAttribute("deal2_STORAGE")
};
using (var writer = await binder.BindAsync<TextWriter>(attributes).ConfigureAwait(false)) {
writer.Write( jsonString.ToString() );
}
}
...
await emailQueueItem.AddAsync( $"{{\"script\":\"DmsBlobTrigger\",\"tsvFileName\":\"{tsvFileName}\",\"status\":\"{retval}\",\"message\":\"{statusMessage}\"}}" );
} catch (Exception excp) {
Logger.Info(excp.ToString());
}
}