2626 PYTHON_THREADPOOL_THREAD_COUNT_MAX_37 ,
2727 PYTHON_THREADPOOL_THREAD_COUNT_MIN ,
2828 PYTHON_ENABLE_DEBUG_LOGGING , SCRIPT_FILE_NAME ,
29- PYTHON_LANGUAGE_RUNTIME )
29+ PYTHON_LANGUAGE_RUNTIME , CUSTOMER_PACKAGES_PATH )
3030from .extension import ExtensionManager
3131from .logging import disable_console_logging , enable_console_logging
32- from .logging import enable_debug_logging_recommendation
3332from .logging import (logger , error_logger , is_system_log_category ,
3433 CONSOLE_LOG_PREFIX , format_exception )
3534from .utils .common import get_app_setting , is_envvar_true
@@ -263,9 +262,14 @@ async def _dispatch_grpc_request(self, request):
263262
264263 async def _handle__worker_init_request (self , request ):
265264 logger .info ('Received WorkerInitRequest, '
266- 'python version %s, worker version %s, request ID %s' ,
267- sys .version , VERSION , self .request_id )
268- enable_debug_logging_recommendation ()
265+ 'python version %s, '
266+ 'worker version %s, '
267+ 'request ID %s.'
268+ ' To enable debug level logging, please refer to '
269+ 'https://aka.ms/python-enable-debug-logging' ,
270+ sys .version ,
271+ VERSION ,
272+ self .request_id )
269273
270274 worker_init_request = request .worker_init_request
271275 host_capabilities = worker_init_request .capabilities
@@ -293,6 +297,10 @@ async def _handle__worker_init_request(self, request):
293297 "Importing azure functions in WorkerInitRequest" )
294298 import azure .functions # NoQA
295299
300+ if CUSTOMER_PACKAGES_PATH not in sys .path :
301+ logger .warning ("Customer packages not in sys path. "
302+ "This should never happen! " )
303+
296304 # loading bindings registry and saving results to a static
297305 # dictionary which will be later used in the invocation request
298306 bindings .load_binding_registry ()
@@ -363,6 +371,7 @@ async def _handle__function_load_request(self, request):
363371 'Received WorkerLoadRequest, request ID %s, function_id: %s,'
364372 'function_name: %s,' , self .request_id , function_id , function_name )
365373
374+ programming_model = "V1"
366375 try :
367376 if not self ._functions .get_function (function_id ):
368377 if function_metadata .properties .get ("worker_indexed" , False ) \
@@ -371,8 +380,7 @@ async def _handle__function_load_request(self, request):
371380 # indexing is enabled and load request is called without
372381 # calling the metadata request. In this case we index the
373382 # function and update the workers registry
374- logger .info (f"Indexing function { function_name } in the "
375- f"load request" )
383+ programming_model = "V2"
376384 _ = self .index_functions (function_path )
377385 else :
378386 # legacy function
@@ -385,17 +393,24 @@ async def _handle__function_load_request(self, request):
385393 self ._functions .add_function (
386394 function_id , func , func_request .metadata )
387395
388- ExtensionManager .function_load_extension (
396+ try :
397+ ExtensionManager .function_load_extension (
398+ function_name ,
399+ func_request .metadata .directory
400+ )
401+ except Exception as ex :
402+ logging .error ("Failed to load extensions: " , ex )
403+ raise
404+
405+ logger .info ('Successfully processed FunctionLoadRequest, '
406+ 'request ID: %s, '
407+ 'function ID: %s,'
408+ 'function Name: %s,'
409+ 'programming model: %s' ,
410+ self .request_id ,
411+ function_id ,
389412 function_name ,
390- func_request .metadata .directory
391- )
392-
393- logger .info ('Successfully processed FunctionLoadRequest, '
394- 'request ID: %s, '
395- 'function ID: %s,'
396- 'function Name: %s' , self .request_id ,
397- function_id ,
398- function_name )
413+ programming_model )
399414
400415 return protos .StreamingMessage (
401416 request_id = self .request_id ,
@@ -532,8 +547,10 @@ async def _handle__function_environment_reload_request(self, request):
532547 """
533548 try :
534549 logger .info ('Received FunctionEnvironmentReloadRequest, '
535- 'request ID: %s' , self .request_id )
536- enable_debug_logging_recommendation ()
550+ 'request ID: %s,'
551+ ' To enable debug level logging, please refer to '
552+ 'https://aka.ms/python-enable-debug-logging' ,
553+ self .request_id )
537554
538555 func_env_reload_request = \
539556 request .function_environment_reload_request
0 commit comments