Skip to content

Commit e38ac7c

Browse files
committed
Fix blocking issues
1 parent dc494a2 commit e38ac7c

File tree

4 files changed

+36
-81
lines changed

4 files changed

+36
-81
lines changed

articles/azure-functions/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@
229229
href: functions-bindings-return-value.md
230230
- name: Handle binding errors
231231
href: functions-bindings-errors.md
232+
- name: Binding definitions for Python v2
233+
href: functions-bindings-triggers-python.md
232234
- name: Frameworks
233235
items:
234236
- name: Express.js

articles/azure-functions/create-first-function-vs-code-python.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ In this section, you use Visual Studio Code to create a local Azure Functions pr
126126
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
127127
```
128128

129-
This tells the local Functions host to use the storage emulator for the storage connection currently required by the v2 model. When you publish your project to Azure, you'll instead use the default storate account. If you're instead using an Azure Storage account, set your storage account connection string here.
129+
This tells the local Functions host to use the storage emulator for the storage connection currently required by the v2 model. When you publish your project to Azure, you'll instead use the default storage account. If you're instead using an Azure Storage account, set your storage account connection string here.
130130

131131
## Start the emulator
132132

articles/azure-functions/functions-reference-python.md

Lines changed: 30 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Use the Python annotations included in the [azure.functions.*](/python/api/azure
6666
::: zone pivot="python-mode-decorators"
6767
Azure Functions expects a function to be a stateless method in your Python script that processes input and produces output. By default, the runtime expects the method to be implemented as a global method in the `function_app.py` file.
6868

69-
Triggers and bindings can be declared and used in a function in a decorator based approach. They are defined in the same file, `function_app.py`, as the functions. As an example, the below _function_app.py_ file represents a function trigger by an HTTP request.
69+
Triggers and bindings can be declared and used in a function in a decorator based approach. They're defined in the same file, `function_app.py`, as the functions. As an example, the below _function_app.py_ file represents a function trigger by an HTTP request.
7070

7171
```python
7272
@app.function_name(name="HttpTrigger1")
@@ -90,20 +90,20 @@ def main(req: azure.functions.HttpRequest) -> str:
9090
return f'Hello, {user}!'
9191
```
9292

93-
At this time, only specific triggers and bindings are supported by the V2 programming model. Supported triggers and bindings are as follows.
93+
At this time, only specific triggers and bindings are supported by the v2 programming model. Supported triggers and bindings are as follows.
9494

9595
| Type | Trigger | Input Binding | Output Binding |
9696
| --- | --- | --- | --- |
9797
| HTTP | x | | |
9898
| Timer | x | | |
99-
| Queue | x | | x |
100-
| Service Bus Topic | x | | x |
101-
| Service Bus Queue | x | | x |
102-
| CosmosDB | x | x | x |
103-
| Blob | x | x | x |
104-
| Event Grid | x | | x |
105-
106-
To learn about known limitations with the V2 model and their workarounds, see [Troubleshoot Python errors in Azure Functions](./recover-python-functions.md?pivots=python-mode-decorators).
99+
| Azure Queue Storage | x | | x |
100+
| Azure Service Bus Topic | x | | x |
101+
| Azure Service Bus Queue | x | | x |
102+
| Azure Cosmos DB | x | x | x |
103+
| Azure Blob Storage | x | x | x |
104+
| Azure Event Grid | x | | x |
105+
106+
To learn about known limitations with the v2 model and their workarounds, see [Troubleshoot Python errors in Azure Functions](./recover-python-functions.md?pivots=python-mode-decorators).
107107
::: zone-end
108108

109109
## Alternate entry point
@@ -189,7 +189,7 @@ The main project folder (<project_root>) can contain the following files:
189189
* *.venv/*: (Optional) Contains a Python virtual environment used by local development.
190190
* *.vscode/*: (Optional) Contains store VSCode configuration. To learn more, see [VSCode setting](https://code.visualstudio.com/docs/getstarted/settings).
191191
* *function_app.py*: This is the default location for all functions and their related triggers and bindings.
192-
* *additional_functions.py*: (Optional) Any additional Python files that contain functions (usually for logical grouping) that are referenced in `function_app.py` through blueprints.
192+
* *additional_functions.py*: (Optional) Any other Python files that contain functions (usually for logical grouping) that are referenced in `function_app.py` through blueprints.
193193
* *tests/*: (Optional) Contains the test cases of your function app.
194194
* *.funcignore*: (Optional) Declares files that shouldn't get published to Azure. Usually, this file contains `.vscode/` to ignore your editor setting, `.venv/` to ignore local Python virtual environment, `tests/` to ignore test cases, and `local.settings.json` to prevent local app settings being published.
195195
* *host.json*: Contains configuration options that affect all functions in a function app instance. This file does get published to Azure. Not all options are supported when running locally. To learn more, see [host.json](functions-host-json.md).
@@ -203,7 +203,7 @@ When you deploy your project to a function app in Azure, the entire contents of
203203
::: zone pivot="python-mode-decorators"
204204
## Blueprints
205205

206-
The v2 programming model introduces the concept of _blueprints_. A blueprint is a new class instantiated to register functions ourside of the core function application. The functions registered in blueprint instances are not indexed directly by function runtime. To get these blueprint functions indexed, the function app needs to register the functions from blueprint instances.
206+
The v2 programming model introduces the concept of _blueprints_. A blueprint is a new class instantiated to register functions outside of the core function application. The functions registered in blueprint instances aren't indexed directly by function runtime. To get these blueprint functions indexed, the function app needs to register the functions from blueprint instances.
207207

208208
Using blueprints provides the following benefits:
209209

@@ -380,20 +380,20 @@ def main(req: func.HttpRequest,
380380

381381
When the function is invoked, the HTTP request is passed to the function as `req`. An entry will be retrieved from the Azure Blob Storage based on the _ID_ in the route URL and made available as `obj` in the function body. Here, the storage account specified is the connection string found in the AzureWebJobsStorage app setting, which is the same storage account used by the function app.
382382

383-
Note that at this time, only specific triggers and bindings are supported by the V2 programming model. Supported triggers and bindings are as follows.
383+
At this time, only specific triggers and bindings are supported by the v2 programming model. Supported triggers and bindings are as follows.
384384

385385
| Type | Trigger | Input Binding | Output Binding |
386386
| --- | --- | --- | --- |
387387
| HTTP | x | | |
388388
| Timer | x | | |
389-
| Queue | x | | x |
390-
| Service Bus Topic | x | | x |
391-
| Service Bus Queue | x | | x |
392-
| CosmosDB | x | x | x |
393-
| Blob | x | x | x |
394-
| Event Grid | x | | x |
389+
| Azure Queue Storage | x | | x |
390+
| Azure Service Bus topic | x | | x |
391+
| Azure Service Bus queue | x | | x |
392+
| Azure Cosmos DB | x | x | x |
393+
| Azure Blob Storage | x | x | x |
394+
| Azure Event Grid | x | | x |
395395

396-
To learn more about defining triggers and bindings in the V2 model, see this [documentation](https://github.com/Azure/azure-functions-python-library/blob/dev/docs/ProgModelSpec.pyi).
396+
To learn more about defining triggers and bindings in the v2 model, see this [documentation](https://github.com/Azure/azure-functions-python-library/blob/dev/docs/ProgModelSpec.pyi).
397397

398398
::: zone-end
399399

@@ -582,7 +582,7 @@ In the previous examples, a binding name `req` is used. This parameter is an [Ht
582582

583583
From the [HttpRequest] object, you can get request headers, query parameters, route parameters, and the message body.
584584

585-
The following example is from the the HTTP trigger template for Python V2 programming model. It is the sample code provided when you create a function from Core Tools or VS Code.
585+
The following example is from the HTTP trigger template for Python v2 programming model. It's the sample code provided when you create a function from Core Tools or VS Code.
586586

587587
```python
588588
@app.function_name(name="HttpTrigger1")
@@ -715,7 +715,7 @@ For a full example, see [Using Flask Framework with Azure Functions](/samples/az
715715

716716
::: zone-end
717717
::: zone pivot="python-mode-decorators"
718-
You can leverage ASGI and WSGI-compatible frameworks such as Flask and FastAPI with your HTTP-triggered Python functions. The following examples demonstrate how to do so.
718+
You can use ASGI and WSGI-compatible frameworks such as Flask and FastAPI with your HTTP-triggered Python functions, which is shown in the following example:
719719

720720
# [ASGI](#tab/asgi)
721721

@@ -872,15 +872,15 @@ def main(req: func.HttpRequest) -> func.HttpResponse:
872872

873873
For local development, application settings are [maintained in the local.settings.json file](functions-develop-local.md#local-settings-file).
874874

875-
Note that when using the new programming model, the following app setting needs to be enabled in the file `localsettings.json` as follows.
875+
When using the new programming model, the following app setting needs to be enabled in the file `localsettings.json` as follows.
876876

877877
```json
878878
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
879879
```
880880

881-
When deploying the function, this setting will not be automatically imported- the flag must be declated in Azure for the function application to run using the V2 model.
881+
When deploying the function, this setting won't be automatically created. You must explicitly create this setting in your function app in Azure for it to run using the v2 model.
882882

883-
Multiple Python workers are not supported in V2 at this time. This means that setting `FUNCTIONS_WORKER_PROCESS_COUNT` to greater than 1 is not supported for the functions using the V2 model.
883+
Multiple Python workers aren't supported in v2 at this time. This means that setting `FUNCTIONS_WORKER_PROCESS_COUNT` to greater than 1 isn't supported for the functions using the v2 model.
884884

885885
::: zone-end
886886

@@ -904,55 +904,9 @@ The runtime uses the available Python version, when you run it locally.
904904

905905
To set a Python function app to a specific language version, you need to specify the language and the version of the language in `LinuxFxVersion` field in site config. For example, to change Python app to use Python 3.8, set `linuxFxVersion` to `python|3.8`.
906906

907-
To learn more about Azure Functions runtime support policy, refer to this [article](./language-support-policy.md)
908-
909-
To see the full list of supported Python versions functions apps, refer to this [article](./supported-languages.md)
910-
911-
# [Azure CLI](#tab/azurecli-linux)
912-
913-
You can view and set the `linuxFxVersion` from the Azure CLI.
914-
915-
Using the Azure CLI, view the current `linuxFxVersion` with the [az functionapp config show](/cli/azure/functionapp/config) command.
916-
917-
```azurecli-interactive
918-
az functionapp config show --name <function_app> \
919-
--resource-group <my_resource_group>
920-
```
921-
922-
In this code, replace `<function_app>` with the name of your function app. Also replace `<my_resource_group>` with the name of the resource group for your function app.
923-
924-
You see the `linuxFxVersion` in the following output, which has been truncated for clarity:
925-
926-
```output
927-
{
928-
...
929-
"kind": null,
930-
"limits": null,
931-
"linuxFxVersion": <LINUX_FX_VERSION>,
932-
"loadBalancing": "LeastRequests",
933-
"localMySqlEnabled": false,
934-
"location": "West US",
935-
"logsDirectorySizeLimit": 35,
936-
...
937-
}
938-
```
939-
940-
You can update the `linuxFxVersion` setting in the function app with the [az functionapp config set](/cli/azure/functionapp/config) command.
941-
942-
```azurecli-interactive
943-
az functionapp config set --name <FUNCTION_APP> \
944-
--resource-group <RESOURCE_GROUP> \
945-
--linux-fx-version <LINUX_FX_VERSION>
946-
```
947-
948-
Replace `<FUNCTION_APP>` with the name of your function app. Also replace `<RESOURCE_GROUP>` with the name of the resource group for your function app. Also, replace `<LINUX_FX_VERSION>` with the Python version you want to use, prefixed by `python|` for example, `python|3.9`.
949-
950-
You can run this command from the [Azure Cloud Shell](../cloud-shell/overview.md) by choosing **Try it** in the preceding code sample. You can also use the [Azure CLI locally](/cli/azure/install-azure-cli) to execute this command after executing [az login](/cli/azure/reference-index#az-login) to sign in.
951-
952-
The function app restarts after the change is made to the site config.
953-
954-
---
907+
To learn how to view and change the `linuxFxVersion` site setting, see [How to target Azure Functions runtime versions](set-runtime-version.md#manual-version-updates-on-linux).
955908

909+
For more general information, see the [Azure Functions runtime support policy](./language-support-policy.md) and [Supported languages in Azure Functions](./supported-languages.md).
956910

957911
## Package management
958912

@@ -976,7 +930,7 @@ Project files and folders that are excluded from publishing, including the virtu
976930

977931
There are three build actions supported for publishing your Python project to Azure: remote build, local build, and builds using custom dependencies.
978932

979-
You can also use Azure Pipelines to build your dependencies and publish using continuous delivery (CD). To learn more, see [Continuous delivery by using Azure DevOps](functions-how-to-azure-devops.md).
933+
You can also use Azure Pipelines to build your dependencies and publish using continuous delivery (CD). To learn more, see [Continuous delivery with Azure Pipelines](functions-how-to-azure-devops.md).
980934

981935
### Remote build
982936

@@ -1002,7 +956,7 @@ func azure functionapp publish <APP_NAME> --build local
1002956

1003957
Remember to replace `<APP_NAME>` with the name of your function app in Azure.
1004958

1005-
When you use the `--build local` option, project dependencies are read from the requirements.txt file and those dependent packages are downloaded and installed locally. Project files and dependencies are deployed from your local computer to Azure. This results in a larger deployment package being uploaded to Azure. If for some reason, you can't get requirements.txt file by Core Tools, you must use the custom dependencies option for publishing.
959+
When you use the `--build local` option, project dependencies are read from the requirements.txt file, and those dependent packages are downloaded and installed locally. Project files and dependencies are deployed from your local computer to Azure. This results in a larger deployment package being uploaded to Azure. If for some reason, you can't get requirements.txt file by Core Tools, you must use the custom dependencies option for publishing.
1006960

1007961
We don't recommend using local builds when developing locally on Windows.
1008962

@@ -1273,7 +1227,6 @@ For a list of preinstalled system libraries in Python worker Docker images, see
12731227

12741228
| Functions runtime | Debian version | Python versions |
12751229
|------------|------------|------------|
1276-
| Version 2.x | Stretch | [Python 3.6](https://github.com/Azure/azure-functions-docker/blob/master/host/2.0/stretch/amd64/python/python36/python36.Dockerfile)<br/>[Python 3.7](https://github.com/Azure/azure-functions-docker/blob/master/host/2.0/stretch/amd64/python/python37/python37.Dockerfile) |
12771230
| Version 3.x | Buster | [Python 3.6](https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/python/python36/python36.Dockerfile)<br/>[Python 3.7](https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/python/python37/python37.Dockerfile)<br />[Python 3.8](https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/python/python38/python38.Dockerfile)<br/> [Python 3.9](https://github.com/Azure/azure-functions-docker/blob/master/host/3.0/buster/amd64/python/python39/python39.Dockerfile)|
12781231

12791232
## Python worker extensions
@@ -1404,7 +1357,7 @@ Following is a list of troubleshooting guides for common issues:
14041357

14051358
Following is a list of troubleshooting guides for known issues with the v2 programming model:
14061359

1407-
* [Could not load file or assembly](recover-python-functions.md#troubleshoot-could-not-load-file-or-assembly)
1360+
* [Couldn't load file or assembly](recover-python-functions.md#troubleshoot-could-not-load-file-or-assembly)
14081361
* [Unable to resolve the Azure Storage connection named Storage](recover-python-functions.md#troubleshoot-unable-to-resolve-the-azure-storage-connection).
14091362

14101363
All known issues and feature requests are tracked using [GitHub issues](https://github.com/Azure/azure-functions-python-worker/issues) list. If you run into a problem and can't find the issue in GitHub, open a new issue and include a detailed description of the problem.

articles/azure-functions/recover-python-functions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ zone_pivot_groups: python-mode-functions
1010

1111
# Troubleshoot Python errors in Azure Functions
1212

13-
This article provides information to help you troubleshoot errors with your Python functions in Azure Functions. This article supports both the v1 and v2 programming models. Please choose your desired model from the seletor at the top of the article. The v2 model is currently in preview. For more information on Python programming models, see the [Python developer guide](./functions-reference-python.md).
13+
This article provides information to help you troubleshoot errors with your Python functions in Azure Functions. This article supports both the v1 and v2 programming models. Choose your desired model from the selector at the top of the article. The v2 model is currently in preview. For more information on Python programming models, see the [Python developer guide](./functions-reference-python.md).
1414

1515
The following is a list of troubleshooting sections for common issues in Python functions:
1616

@@ -268,7 +268,7 @@ This specific error may ready:
268268
> `DurableTask.Netherite.AzureFunctions: Could not load file or assembly 'Microsoft.Azure.WebJobs.Extensions.DurableTask, Version=2.0.0.0, Culture=neutral, PublicKeyToken=014045d636e89289'.`
269269
> `The system cannot find the file specified.`
270270
271-
The reason this error may be occuring is because of an issue with how the extension bundle was cached. To detect if this is the issue, you can run the command with `--verbose` to see more details.
271+
The reason this error may be occurring is because of an issue with how the extension bundle was cached. To detect if this is the issue, you can run the command with `--verbose` to see more details.
272272
273273
> `func host start --verbose`
274274
@@ -310,7 +310,7 @@ You may see this error in your local output as the following message:
310310
> `Value cannot be null. (Parameter 'provider')`
311311
312312
This error is a result of how extensions are loaded from the bundle locally. To resolve this error, you can do one of the following:
313-
* Use a storage emulator such as [Azurerite](../storage/common/storage-use-azurite.md). This is a good option when you aren't planning to use a storage account in your function application.
313+
* Use a storage emulator such as [Azurite](../storage/common/storage-use-azurite.md). This is a good option when you aren't planning to use a storage account in your function application.
314314
* Create a storage account and add a connection string to the `AzureWebJobsStorage` environment variable in `localsettings.json`. Use this option when you are using a storage account trigger or binding with your application, or if you have an existing storage account. To get started, see [Create a storage account](../storage/common/storage-account-create.md).
315315
316316
## Issue with Deployment

0 commit comments

Comments
 (0)