code: def run_lightning_flow(
      entrypoint_file: str,
      queue_id: str,
      base_url: str,
      queues: Optional[FlowRestAPIQueues] = None,
  ):
      _set_flow_context()
  
      logger.debug(
          f"Run Lightning Flow {entrypoint_file} {queue_id} {base_url}"
      )
  
      app = load_app_from_file(entrypoint_file)
      app.backend = CloudBackend(entrypoint_file, queue_id=queue_id)
  
      queue_system = app.backend.queues
      app.backend.update_lightning_app_frontend(app)
      wait_for_queues(queue_system)
  
      app.backend.resolve_url(app, base_url)
      if app.root_path != "":
          app._update_index_file()
      app.backend._prepare_queues(app)
  
      # Note: Override the queues if provided
      if queues:
          app.api_publish_state_queue = queues[
              "api_publish_state_queue"
          ]
          app.api_response_queue = queues["api_response_queue"]
  
      LightningFlow._attach_backend(app.root, app.backend)
  
      app.should_publish_changes_to_api = True
  
      storage_orchestrator = StorageOrchestrator(
          app,
          app.request_queues,
          app.response_queues,
          app.copy_request_queues,
          app.copy_response_queues,
      )
      storage_orchestrator.setDaemon(True)
      storage_orchestrator.start()
  
      # refresh the layout with the populated urls.
      app._update_layout()
  
      # register a signal handler to clean all works.
      if sys.platform != "win32":
          signal.signal(
              signal.SIGTERM, partial(_sigterm_flow_handler, app=app)
          )
  
      if "apis" in inspect.signature(start_server).parameters:
          from lightning.app.utilities.commands.base import (
              _prepare_commands,
          )
  
          _prepare_commands(app)
  
      # Once the bootstrapping is done, running the rank 0
      # app with all the components inactive
      try:
          app._run()
      except ExitAppException:
          pass
      except Exception:
          app.stage = AppStage.FAILED
          print(traceback.format_exc())
  
      storage_orchestrator.join(0)
      app.backend.stop_all_works(app.works)
  
      exit_code = 1 if app.stage == AppStage.FAILED else 0
      print(f"Finishing the App with exit_code: {str(exit_code)}...")
  
      if not exit_code:
          app.backend.stop_app(app)
  
      sys.exit(exit_code)
  
imports: import inspect
  import logging
  import os
  import signal
  import sys
  import time
  import traceback
  from functools import partial
  from multiprocessing import Process
  from typing import Callable, Dict, List, Optional, Tuple, TypedDict
label_desc: Use image node_id 3 for calling a global function with example usage: run_lightning_flow(entrypoint_file, queue_id, base_url, queues) without return types