0

This is the first time to use Azure and I am trying to make a pipeline using Azure. What I want to do is to make multiple outputblobs so that I can duplicate a file.

def main(inputblob: func.InputStream,
         outputblob_first: func.Out[func.InputStream],
         outputblob_second: func.Out[func.InputStream],
         outputblob_third: func.Out[func.InputStream]):
   
   outputblob_first.set(inputblob)
   outputblob_second.set(inputblob)
   outputblob_third.set(inputblob)

This is init.py.

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "inputblob",
      "type": "blobTrigger",
      "direction": "in",
      "dataType": "binary",
      "path": "blobcontainer/{name}",
      "connection": "AzureWebJobsStorage"
    },
    {
      "name": "outputblob_first",
      "type": "blob",
      "path": "uploadblobcontainer/{blobtrigger}-first",
      "dataType": "binary",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    },
    {
      "name": "outputblob_second",
      "type": "blob",
      "path": "uploadblobcontainer/{blobtrigger}-second",
      "dataType": "binary",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    },
    {
      "name": "outputblob_third",
      "type": "blob",
      "path": "uploadblobcontainer/{blobtrigger}-third",
      "dataType": "binary",
      "connection": "AzureWebJobsStorage",
      "direction": "out"
    }
  ]
}

and this is the json file, function.json

However, it does not work what I expected. I could not find where I did mistake and I want to solve this problem. Can you guys give me some solutions?

3
  • How do you trigger this function? Is it successful? Post logs from console/App-Insights? Commented Feb 2, 2021 at 16:14
  • The trigger is when I upload a file to blobcontainer, which is blob storage. It works correctly when I set only one outputblob. When I set multiple outputblobs the log says Host lock lease acquired by instance ID and Singleton lock acquired Commented Feb 2, 2021 at 16:21
  • post what you see in logs, with one output binding and with multiple output bindings. Also have you tried using func.Out[str] instead of func.Out[func.InputStream]? If not try it out. PS: Host lock lease acquired by instance ID and Singleton lock acquired is always there. Post full log instead of what YOU think is irrelevant. Commented Feb 2, 2021 at 16:30

1 Answer 1

1

When I test it for you, I get the following error message:

The 'BlobTrigger' function is in error: The binding name outputblob_first is invalid. Please assign a valid name to the binding.

enter image description here

I think you need to change your binding name. You can refer to my sample:

import logging
import azure.functions as func


def main(inputblob: func.InputStream,
        outputblob1: func.Out[func.InputStream],
        outputblob2: func.Out[func.InputStream],
        outputblob3: func.Out[func.InputStream]):
    logging.info(f"Python blob trigger function processed blob \n"
                 f"Name: {inputblob.name}\n"
                 f"Blob Size: {inputblob.length} bytes")
    outputblob1.set(inputblob)
    outputblob2.set(inputblob)
    outputblob3.set(inputblob)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.