Skip to content

Commit b1301aa

Browse files
committed
Addressed comments
1 parent 7524060 commit b1301aa

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

azure_functions_worker/dispatcher.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import queue
1313
import sys
1414
import threading
15+
from _ctypes_test import func
1516
from asyncio import BaseEventLoop
1617
from logging import LogRecord
1718
from typing import List, Optional
@@ -318,10 +319,10 @@ async def _handle__functions_metadata_request(self, request):
318319
if indexed_functions:
319320
indexed_function_logs: List[str] = []
320321
for func in indexed_functions:
321-
function_log = \
322-
f"Function Name: {func.get_function_name()} " \
323-
"Function Binding: " \
324-
f"{[(binding.type, binding.name) for binding in func.get_bindings()]}" # NoQA
322+
function_log = "Function Name: {}, Function Binding: {}" \
323+
.format(func.get_function_name(),
324+
[(binding.type, binding.name) for binding in
325+
func.get_bindings()])
325326
indexed_function_logs.append(function_log)
326327

327328
logger.info(
@@ -332,8 +333,8 @@ async def _handle__functions_metadata_request(self, request):
332333
self._functions,
333334
indexed_functions)
334335
else:
335-
logger.warning("No functions indexed. Please refer to the "
336-
"documentation.")
336+
logger.warning("No functions indexed. Please refer to "
337+
"aka.ms/pythonprogrammingmodel for more info.")
337338

338339
return protos.StreamingMessage(
339340
request_id=request.request_id,

azure_functions_worker/loader.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
_DEFAULT_SCRIPT_FILENAME = '__init__.py'
2222
_DEFAULT_ENTRY_POINT = 'main'
2323

24+
PKGS_PATH = pathlib.Path("site/wwwroot/.python_packages")
25+
home = pathlib.Path.home()
26+
pkgs_path = os.path.join(home, PKGS_PATH)
27+
28+
2429
_submodule_dirs = []
2530

2631

@@ -89,8 +94,9 @@ def process_indexed_function(functions_registry: functions.Registry,
8994
message=f'Please check the requirements.txt file for the missing module. '
9095
f'For more info, please refer the troubleshooting'
9196
f' guide: {MODULE_NOT_FOUND_TS_URL} ',
92-
debug_logs=f'Sys Path: {sys.path}, Sys Module: {sys.modules}'
93-
)
97+
debug_logs='Error in load_function. '
98+
f'Sys Path: {sys.path}, Sys Module: {sys.modules},'
99+
f'python-packages Path exists: {os.path.exists(pkgs_path)}')
94100
def load_function(name: str, directory: str, script_file: str,
95101
entry_point: Optional[str]):
96102
dir_path = pathlib.Path(directory)
@@ -139,7 +145,9 @@ def load_function(name: str, directory: str, script_file: str,
139145
@attach_message_to_exception(
140146
expt_type=ImportError,
141147
message=f'Troubleshooting Guide: {MODULE_NOT_FOUND_TS_URL}',
142-
debug_logs=f'Sys Path: {sys.path}, Sys Module: {sys.modules}')
148+
debug_logs='Error in index_function_app. '
149+
f'Sys Path: {sys.path}, Sys Module: {sys.modules},'
150+
f'python-packages Path exists: {os.path.exists(pkgs_path)}')
143151
def index_function_app(function_path: str):
144152
module_name = pathlib.Path(function_path).stem
145153
imported_module = importlib.import_module(module_name)

azure_functions_worker/utils/wrappers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def call(*args, **kwargs):
1818
if flag_default and not is_envvar_false(flag):
1919
return func(*args, **kwargs)
2020
return default
21-
2221
return call
23-
2422
return decorate
2523

2624

@@ -34,9 +32,7 @@ def call(*args, **kwargs):
3432
if flag_default and not is_envvar_false(flag):
3533
return default
3634
return func(*args, **kwargs)
37-
3835
return call
39-
4036
return decorate
4137

4238

@@ -50,7 +46,5 @@ def call(*args, **kwargs):
5046
if debug_logs is not None:
5147
logger.error(debug_logs)
5248
raise extend_exception_message(e, message)
53-
5449
return call
55-
5650
return decorate

tests/endtoend/test_sql_functions.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33
import json
4+
from unittest import skip
45

56
from azure_functions_worker import testutils
67

78

9+
@skip("Unskip when azure functions with SQL is released.")
810
class TestSqlFunctions(testutils.WebHostTestCase):
911

1012
@classmethod

0 commit comments

Comments
 (0)