parameters: (
      requested_orig_obj,
      requested_dest_obj,
      streetnetwork_path_pool,
      orig_places_free_access,
      dest_places_free_access,
      orig_fallback_durations_pool,
      dest_fallback_durations_pool,
      request,
      journeys,
      request_id,
  )
docstring: In this function, we compute all fallback path once the pt journey is finished, then we build the
      whole pt journey by adding the fallback path to the beginning and the ending section of pt journey
docstring_summary: In this function, we compute all fallback path once the pt journey is finished, then we build the
      whole pt journey by adding the fallback path to the beginning and the ending section of pt journey
docstring_tokens: In this function we compute all fallback path once the pt journey is finished then we build the whole pt journey by adding the fallback path to the beginning and the ending section of pt journey
function: def wait_and_complete_pt_journey(
      requested_orig_obj,
      requested_dest_obj,
      streetnetwork_path_pool,
      orig_places_free_access,
      dest_places_free_access,
      orig_fallback_durations_pool,
      dest_fallback_durations_pool,
      request,
      journeys,
      request_id,
  ):
      """
      In this function, we compute all fallback path once the pt journey is finished, then we build the
      whole pt journey by adding the fallback path to the beginning and the ending section of pt journey
      """
      if len(journeys) == 0:
          # Early return if no journey has to be finished
          return
  
      logger = logging.getLogger(__name__)
      # launch fallback direct path asynchronously
      sub_request_id = "{}_fallback".format(request_id)
      with timed_logger(logger, 'compute_fallback', sub_request_id):
          compute_fallback(
              from_obj=requested_orig_obj,
              to_obj=requested_dest_obj,
              streetnetwork_path_pool=streetnetwork_path_pool,
              orig_places_free_access=orig_places_free_access,
              dest_places_free_access=dest_places_free_access,
              orig_fallback_durations_pool=orig_fallback_durations_pool,
              dest_fallback_durations_pool=dest_fallback_durations_pool,
              request=request,
              pt_journeys=journeys,
              request_id=sub_request_id,
          )
  
      # launch compute transfer asynchronously
      transfer_sections = []
      if request['_transfer_path'] is True:
          sub_request_transfer_id = "{}_transfer".format(request_id)
          with timed_logger(logger, 'compute_transfer', sub_request_transfer_id):
              transfer_sections = compute_transfer(
                  pt_journey=journeys,
                  transfer_path_pool=streetnetwork_path_pool,
                  request=request,
                  request_id=sub_request_transfer_id,
              )
  
      with timed_logger(logger, 'complete_pt_journeys', request_id):
          for pt_element in journeys:
              complete_pt_journey(
                  requested_orig_obj=requested_orig_obj,
                  requested_dest_obj=requested_dest_obj,
                  dep_mode=pt_element.dep_mode,
                  arr_mode=pt_element.arr_mode,
                  pt_journey=pt_element.pt_journeys,
                  streetnetwork_path_pool=streetnetwork_path_pool,
                  orig_places_free_access=orig_places_free_access,
                  dest_places_free_access=dest_places_free_access,
                  orig_fallback_durations_pool=orig_fallback_durations_pool,
                  dest_fallback_durations_pool=dest_fallback_durations_pool,
                  request=request,
              )
  
      if request['_transfer_path'] is True:
          with timed_logger(logger, 'complete_transfer', request_id):
              complete_transfer(
                  pt_journey=journeys,
                  transfer_path_pool=streetnetwork_path_pool,
                  request=request,
                  transfer_sections=transfer_sections,
              )
function_tokens: def wait_and_complete_pt_journey ( requested_orig_obj , requested_dest_obj , streetnetwork_path_pool , orig_places_free_access , dest_places_free_access , orig_fallback_durations_pool , dest_fallback_durations_pool , request , journeys , request_id , ) : if len ( journeys ) == 0 : # Early return if no journey has to be finished return logger = logging . getLogger ( __name__ ) # launch fallback direct path asynchronously sub_request_id = "{}_fallback" . format ( request_id ) with timed_logger ( logger , 'compute_fallback' , sub_request_id ) : compute_fallback ( from_obj = requested_orig_obj , to_obj = requested_dest_obj , streetnetwork_path_pool = streetnetwork_path_pool , orig_places_free_access = orig_places_free_access , dest_places_free_access = dest_places_free_access , orig_fallback_durations_pool = orig_fallback_durations_pool , dest_fallback_durations_pool = dest_fallback_durations_pool , request = request , pt_journeys = journeys , request_id = sub_request_id , ) # launch compute transfer asynchronously transfer_sections = [ ] if request [ '_transfer_path' ] is True : sub_request_transfer_id = "{}_transfer" . format ( request_id ) with timed_logger ( logger , 'compute_transfer' , sub_request_transfer_id ) : transfer_sections = compute_transfer ( pt_journey = journeys , transfer_path_pool = streetnetwork_path_pool , request = request , request_id = sub_request_transfer_id , ) with timed_logger ( logger , 'complete_pt_journeys' , request_id ) : for pt_element in journeys : complete_pt_journey ( requested_orig_obj = requested_orig_obj , requested_dest_obj = requested_dest_obj , dep_mode = pt_element . dep_mode , arr_mode = pt_element . arr_mode , pt_journey = pt_element . pt_journeys , streetnetwork_path_pool = streetnetwork_path_pool , orig_places_free_access = orig_places_free_access , dest_places_free_access = dest_places_free_access , orig_fallback_durations_pool = orig_fallback_durations_pool , dest_fallback_durations_pool = dest_fallback_durations_pool , request = request , ) if request [ '_transfer_path' ] is True : with timed_logger ( logger , 'complete_transfer' , request_id ) : complete_transfer ( pt_journey = journeys , transfer_path_pool = streetnetwork_path_pool , request = request , transfer_sections = transfer_sections , )