@@ -302,9 +302,12 @@ async def _handle__worker_init_request(self, request):
302
302
bindings .load_binding_registry ()
303
303
304
304
if is_envvar_true (PYTHON_ENABLE_INIT_INDEXING ):
305
- self .load_function_metadata (
306
- worker_init_request .function_app_directory ,
307
- caller_info = "worker_init_request" )
305
+ try :
306
+ self .load_function_metadata (
307
+ worker_init_request .function_app_directory ,
308
+ caller_info = "worker_init_request" )
309
+ except Exception as ex :
310
+ self ._function_metadata_exception = ex
308
311
309
312
return protos .StreamingMessage (
310
313
request_id = self .request_id ,
@@ -332,31 +335,41 @@ def load_function_metadata(self, function_app_directory, caller_info):
332
335
setting = PYTHON_SCRIPT_FILE_NAME ,
333
336
default_value = f'{ PYTHON_SCRIPT_FILE_NAME_DEFAULT } ' )
334
337
335
- logger .info (
336
- 'Received load metadata request from from %s, request ID %s, '
338
+ logger .debug (
339
+ 'Received load metadata request from %s, request ID %s, '
337
340
'script_file_name: %s' ,
338
341
caller_info , self .request_id , script_file_name )
339
342
340
- try :
341
- validate_script_file_name (script_file_name )
342
- function_path = os .path .join (function_app_directory ,
343
- script_file_name )
343
+ validate_script_file_name (script_file_name )
344
+ function_path = os .path .join (function_app_directory ,
345
+ script_file_name )
344
346
345
- self ._function_metadata_result = (
346
- self .index_functions (function_path )) \
347
- if os .path .exists (function_path ) else None
348
-
349
- except Exception as ex :
350
- self ._function_metadata_exception = ex
347
+ self ._function_metadata_result = (
348
+ self .index_functions (function_path )) \
349
+ if os .path .exists (function_path ) else None
351
350
352
351
async def _handle__functions_metadata_request (self , request ):
353
352
metadata_request = request .functions_metadata_request
354
353
function_app_directory = metadata_request .function_app_directory
355
354
355
+ script_file_name = get_app_setting (
356
+ setting = PYTHON_SCRIPT_FILE_NAME ,
357
+ default_value = f'{ PYTHON_SCRIPT_FILE_NAME_DEFAULT } ' )
358
+ function_path = os .path .join (function_app_directory ,
359
+ script_file_name )
360
+
361
+ logger .info (
362
+ 'Received WorkerMetadataRequest, request ID %s, '
363
+ 'function_path: %s' ,
364
+ self .request_id , function_path )
365
+
356
366
if not is_envvar_true (PYTHON_ENABLE_INIT_INDEXING ):
357
- self .load_function_metadata (
358
- function_app_directory ,
359
- caller_info = "functions_metadata_request" )
367
+ try :
368
+ self .load_function_metadata (
369
+ function_app_directory ,
370
+ caller_info = "functions_metadata_request" )
371
+ except Exception as ex :
372
+ self ._function_metadata_exception = ex
360
373
361
374
if self ._function_metadata_exception :
362
375
return protos .StreamingMessage (
@@ -404,9 +417,12 @@ async def _handle__function_load_request(self, request):
404
417
# function and update the workers registry
405
418
406
419
if not is_envvar_true (PYTHON_ENABLE_INIT_INDEXING ):
407
- self .load_function_metadata (
408
- function_app_directory ,
409
- caller_info = "functions_load_request" )
420
+ try :
421
+ self .load_function_metadata (
422
+ function_app_directory ,
423
+ caller_info = "functions_load_request" )
424
+ except Exception as ex :
425
+ self ._function_metadata_exception = ex
410
426
411
427
# For the second worker, if there was an exception in
412
428
# indexing, we raise it here
@@ -626,9 +642,12 @@ async def _handle__function_environment_reload_request(self, request):
626
642
bindings .load_binding_registry ()
627
643
628
644
if is_envvar_true (PYTHON_ENABLE_INIT_INDEXING ):
629
- self .load_function_metadata (
630
- directory ,
631
- caller_info = "environment_reload_request" )
645
+ try :
646
+ self .load_function_metadata (
647
+ directory ,
648
+ caller_info = "environment_reload_request" )
649
+ except Exception as ex :
650
+ self ._function_metadata_exception = ex
632
651
633
652
# Change function app directory
634
653
if getattr (func_env_reload_request ,
0 commit comments