File tree Expand file tree Collapse file tree 5 files changed +36
-5
lines changed
azure_functions_worker_v2
azure_functions_worker_v2 Expand file tree Collapse file tree 5 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -132,3 +132,8 @@ prof/
132
132
tests /** /host.json
133
133
tests /** /bin
134
134
tests /** /extensions.csproj
135
+
136
+ # Azurite related files
137
+ __blobstorage__ /*
138
+ __queuestorage__ /*
139
+ __azurite *
Original file line number Diff line number Diff line change 16
16
HTTP ,
17
17
HTTP_TRIGGER ,
18
18
)
19
+ from ..utils .helpers import set_sdk_version
19
20
20
21
21
22
PB_TYPE = 'rpc_data'
@@ -59,13 +60,15 @@ def load_binding_registry() -> None:
59
60
not found, it loads the builtin. If the BINDING_REGISTRY is None,
60
61
azure-functions hasn't been loaded in properly.
61
62
62
- Tries to load the base extension only for python 3.8+ .
63
+ Tries to load the base extension.
63
64
"""
64
65
65
66
func = sys .modules .get ('azure.functions' )
66
67
67
68
if func is None :
68
69
import azure .functions as func
70
+
71
+ set_sdk_version (func .__version__ ) # type: ignore
69
72
70
73
global BINDING_REGISTRY
71
74
BINDING_REGISTRY = func .get_binding_registry () # type: ignore
Original file line number Diff line number Diff line change 47
47
WORKER_OPEN_TELEMETRY_ENABLED ,
48
48
WORKER_STATUS )
49
49
from .utils .executor import get_current_loop , execute_async , run_sync_func
50
- from .utils .helpers import change_cwd , get_worker_metadata
50
+ from .utils .helpers import change_cwd , get_sdk_version , get_worker_metadata
51
51
from .utils .tracing import serialize_exception , serialize_exception_as_str
52
52
from .utils .validators import validate_script_file_name
53
53
@@ -128,8 +128,9 @@ async def worker_init_request(request):
128
128
async def functions_metadata_request (request ):
129
129
global protos , _metadata_result , _metadata_exception
130
130
logger .debug ("V2 Library Worker: received WorkerMetadataRequest."
131
- " Metadata Result: %s, Metadata Exception: %s" ,
132
- _metadata_result , _metadata_exception )
131
+ " Metadata Result: %s, Metadata Exception: %s,"
132
+ " azure-functions version: %s" ,
133
+ _metadata_result , _metadata_exception , get_sdk_version ())
133
134
134
135
if _metadata_exception :
135
136
return protos .FunctionMetadataResponse (
Original file line number Diff line number Diff line change 9
9
from ..logging import logger
10
10
from ..version import VERSION
11
11
12
+ sdk_version : str = "0.0.0"
13
+
14
+
15
+ def set_sdk_version (version : str ):
16
+ """Set the SDK version."""
17
+ global sdk_version
18
+ sdk_version = version
19
+
20
+
21
+ def get_sdk_version () -> str :
22
+ """Get the SDK version."""
23
+ return sdk_version
24
+
12
25
13
26
def change_cwd (new_cwd : str ):
14
27
if os .path .exists (new_cwd ):
Original file line number Diff line number Diff line change 6
6
import unittest
7
7
from unittest .mock import patch
8
8
9
- from azure_functions_worker_v2 .utils import app_setting_manager , validators , wrappers
9
+ from azure_functions_worker_v2 .utils import (app_setting_manager ,
10
+ helpers ,
11
+ validators ,
12
+ wrappers )
10
13
11
14
TEST_APP_SETTING_NAME = "TEST_APP_SETTING_NAME"
12
15
TEST_FEATURE_FLAG = "APP_SETTING_FEATURE_FLAG"
@@ -319,6 +322,12 @@ def test_invalid_script_file_name(self):
319
322
file_name = 'test'
320
323
with self .assertRaises (validators .InvalidFileNameError ):
321
324
validators .validate_script_file_name (file_name )
325
+
326
+ def test_set_get_sdk_version (self ):
327
+ test_version = '1.2.3'
328
+ helpers .set_sdk_version (test_version )
329
+ self .assertEqual (helpers .get_sdk_version (), test_version )
330
+
322
331
323
332
def _unset_feature_flag (self ):
324
333
try :
You can’t perform that action at this time.
0 commit comments