|
1 | 1 | # Copyright (c) Microsoft Corporation. All rights reserved.
|
2 | 2 | # Licensed under the MIT License.
|
3 |
| -# TODO: organize this better |
4 |
| - |
5 | 3 | import sys
|
6 | 4 |
|
| 5 | +# Constants for Azure Functions Python Worker |
| 6 | +CUSTOMER_PACKAGES_PATH = "/home/site/wwwroot/.python_packages/lib/site" \ |
| 7 | + "-packages" |
| 8 | +HTTP = "http" |
| 9 | +HTTP_TRIGGER = "httpTrigger" |
| 10 | +METADATA_PROPERTIES_WORKER_INDEXED = "worker_indexed" |
| 11 | +MODULE_NOT_FOUND_TS_URL = "https://aka.ms/functions-modulenotfound" |
| 12 | +PYTHON_LANGUAGE_RUNTIME = "python" |
| 13 | +RETRY_POLICY = "retry_policy" |
7 | 14 | TRUE = "true"
|
8 | 15 | TRACEPARENT = "traceparent"
|
9 | 16 | TRACESTATE = "tracestate"
|
| 17 | +X_MS_INVOCATION_ID = "x-ms-invocation-id" |
| 18 | + |
10 | 19 |
|
11 | 20 | # Capabilities
|
| 21 | +FUNCTION_DATA_CACHE = "FunctionDataCache" |
| 22 | +HTTP_URI = "HttpUri" |
12 | 23 | RAW_HTTP_BODY_BYTES = "RawHttpBodyBytes"
|
13 |
| -TYPED_DATA_COLLECTION = "TypedDataCollection" |
| 24 | +REQUIRES_ROUTE_PARAMETERS = "RequiresRouteParameters" |
14 | 25 | RPC_HTTP_BODY_ONLY = "RpcHttpBodyOnly"
|
15 | 26 | RPC_HTTP_TRIGGER_METADATA_REMOVED = "RpcHttpTriggerMetadataRemoved"
|
16 |
| -WORKER_STATUS = "WorkerStatus" |
17 | 27 | SHARED_MEMORY_DATA_TRANSFER = "SharedMemoryDataTransfer"
|
18 |
| -FUNCTION_DATA_CACHE = "FunctionDataCache" |
19 |
| -HTTP_URI = "HttpUri" |
20 |
| -REQUIRES_ROUTE_PARAMETERS = "RequiresRouteParameters" |
| 28 | +TYPED_DATA_COLLECTION = "TypedDataCollection" |
21 | 29 | # When this capability is enabled, logs are not piped back to the
|
22 | 30 | # host from the worker. Logs will directly go to where the user has
|
23 | 31 | # configured them to go. This is to ensure that the logs are not
|
24 | 32 | # duplicated.
|
25 | 33 | WORKER_OPEN_TELEMETRY_ENABLED = "WorkerOpenTelemetryEnabled"
|
| 34 | +WORKER_STATUS = "WorkerStatus" |
| 35 | + |
26 | 36 |
|
27 | 37 | # Platform Environment Variables
|
28 | 38 | AZURE_WEBJOBS_SCRIPT_ROOT = "AzureWebJobsScriptRoot"
|
29 | 39 | CONTAINER_NAME = "CONTAINER_NAME"
|
30 |
| -# Python Specific Feature Flags and App Settings |
31 |
| -PYTHON_THREADPOOL_THREAD_COUNT = "PYTHON_THREADPOOL_THREAD_COUNT" |
32 |
| -PYTHON_ENABLE_DEBUG_LOGGING = "PYTHON_ENABLE_DEBUG_LOGGING" |
33 |
| -FUNCTIONS_WORKER_SHARED_MEMORY_DATA_TRANSFER_ENABLED = \ |
34 |
| - "FUNCTIONS_WORKER_SHARED_MEMORY_DATA_TRANSFER_ENABLED" |
35 |
| -""" |
36 |
| -Comma-separated list of directories where shared memory maps can be created for |
37 |
| -data transfer between host and worker. |
38 |
| -""" |
39 |
| -UNIX_SHARED_MEMORY_DIRECTORIES = "FUNCTIONS_UNIX_SHARED_MEMORY_DIRECTORIES" |
40 |
| - |
41 |
| -# Setting Defaults |
42 |
| -PYTHON_THREADPOOL_THREAD_COUNT_DEFAULT = 1 |
43 |
| -PYTHON_THREADPOOL_THREAD_COUNT_MIN = 1 |
44 |
| -PYTHON_THREADPOOL_THREAD_COUNT_MAX = sys.maxsize |
45 |
| -PYTHON_THREADPOOL_THREAD_COUNT_MAX_37 = 32 |
46 |
| - |
47 |
| -# new programming model default script file name |
48 |
| -PYTHON_SCRIPT_FILE_NAME = "PYTHON_SCRIPT_FILE_NAME" |
49 |
| -PYTHON_SCRIPT_FILE_NAME_DEFAULT = "function_app.py" |
50 |
| - |
51 |
| -# External Site URLs |
52 |
| -MODULE_NOT_FOUND_TS_URL = "https://aka.ms/functions-modulenotfound" |
53 |
| - |
54 |
| -PYTHON_LANGUAGE_RUNTIME = "python" |
55 |
| - |
56 |
| -# Settings for V2 programming model |
57 |
| -RETRY_POLICY = "retry_policy" |
58 |
| - |
59 |
| -# Paths |
60 |
| -CUSTOMER_PACKAGES_PATH = "/home/site/wwwroot/.python_packages/lib/site" \ |
61 |
| - "-packages" |
62 |
| - |
63 |
| -METADATA_PROPERTIES_WORKER_INDEXED = "worker_indexed" |
64 |
| - |
65 |
| -# Header names |
66 |
| -X_MS_INVOCATION_ID = "x-ms-invocation-id" |
67 |
| - |
68 |
| -# Trigger Names |
69 |
| -HTTP_TRIGGER = "httpTrigger" |
70 |
| - |
71 |
| -# Output Names |
72 |
| -HTTP = "http" |
73 | 40 |
|
74 |
| -# Base extension supported Python minor version |
75 |
| -BASE_EXT_SUPPORTED_PY_MINOR_VERSION = 8 |
76 |
| - |
77 |
| -# Appsetting to turn on OpenTelemetry support/features |
78 |
| -# A value of "true" enables the setting |
79 |
| -PYTHON_ENABLE_OPENTELEMETRY = "PYTHON_ENABLE_OPENTELEMETRY" |
80 | 41 |
|
| 42 | +# Python Specific Feature Flags and App Settings |
| 43 | +# Appsetting to specify AppInsights connection string |
| 44 | +APPLICATIONINSIGHTS_CONNECTION_STRING = "APPLICATIONINSIGHTS_CONNECTION_STRING" |
81 | 45 | # Appsetting to turn on ApplicationInsights support/features
|
82 | 46 | # A value of "true" enables the setting
|
83 | 47 | PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY = \
|
84 | 48 | "PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY"
|
85 |
| - |
86 | 49 | # Appsetting to specify root logger name of logger to collect telemetry for
|
87 | 50 | # Used by Azure monitor distro (Application Insights)
|
88 | 51 | PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME = "PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME"
|
89 | 52 | PYTHON_APPLICATIONINSIGHTS_LOGGER_NAME_DEFAULT = ""
|
90 |
| - |
91 |
| -# Appsetting to specify AppInsights connection string |
92 |
| -APPLICATIONINSIGHTS_CONNECTION_STRING = "APPLICATIONINSIGHTS_CONNECTION_STRING" |
| 53 | +PYTHON_ENABLE_DEBUG_LOGGING = "PYTHON_ENABLE_DEBUG_LOGGING" |
| 54 | +# Appsetting to turn on OpenTelemetry support/features |
| 55 | +# A value of "true" enables the setting |
| 56 | +PYTHON_ENABLE_OPENTELEMETRY = "PYTHON_ENABLE_OPENTELEMETRY" |
| 57 | +# Allows for non-default script file name |
| 58 | +PYTHON_SCRIPT_FILE_NAME = "PYTHON_SCRIPT_FILE_NAME" |
| 59 | +PYTHON_SCRIPT_FILE_NAME_DEFAULT = "function_app.py" |
| 60 | +PYTHON_THREADPOOL_THREAD_COUNT = "PYTHON_THREADPOOL_THREAD_COUNT" |
| 61 | +PYTHON_THREADPOOL_THREAD_COUNT_DEFAULT = 1 |
| 62 | +PYTHON_THREADPOOL_THREAD_COUNT_MAX = sys.maxsize |
| 63 | +PYTHON_THREADPOOL_THREAD_COUNT_MIN = 1 |
0 commit comments