code: def run_main():
      logging.basicConfig(
          level=(logging.INFO),
          format="[%(asctime)s] [%(process)s] [%(threadName)s] [%(levelname)s] (%(name)s:%(lineno)d) - %(message)s",
      )
  
      parser = argparse.ArgumentParser()
      parser.add_argument("-a", "--app", type=str, default=None)
      parser.add_argument("-s", "--studies", type=str, default=None)
      parser.add_argument(
          "-m",
          "--method",
          required=True,
          choices=["infer", "train", "info", "batch_infer", "scoring"],
      )
      parser.add_argument("-r", "--request", type=str, default="{}")
      parser.add_argument("-o", "--output", type=str, default=None)
      parser.add_argument("-d", "--debug", action="store_true")
      parser.add_argument("--multi_gpu", action="store_true")
      parser.add_argument("--local_rank", type=int, default=0)
  
      args = parser.parse_args()
      for arg in vars(args):
          logger.debug(f"USING:: {arg} = {getattr(args, arg)}")
      logger.debug("")
  
      logger.debug(
          "------------------------------------------------------"
      )
      logger.debug("SETTINGS")
      logger.debug(
          "------------------------------------------------------"
      )
      logger.debug(json.dumps(settings.dict(), indent=2))
      logger.debug("")
  
      app_dir = args.app if args.app else settings.MONAI_LABEL_APP_DIR
      studies = (
          args.studies if args.studies else settings.MONAI_LABEL_STUDIES
      )
      logger.debug(f"++ APP_DIR: {app_dir}")
      logger.debug(f"++ STUDIES: {studies}")
  
      logging.basicConfig(
          level=(logging.DEBUG if args.debug else logging.INFO),
          format="[%(asctime)s] [%(threadName)s] [%(levelname)s] (%(name)s:%(lineno)d) - %(message)s",
      )
  
      a = app_instance(app_dir=app_dir, studies=studies)
      request = json.loads(args.request)
      result = None
  
      if args.method == "infer":
          res_img, res_json = a.infer(request=request)
          result = {"label": res_img, "params": res_json}
      elif args.method == "train":
          request["local_rank"] = args.local_rank
          result = a.train(request)
      elif args.method == "info":
          result = a.info(request)
      elif args.method == "batch_infer":
          result = a.batch_infer(request)
      elif args.method == "scoring":
          result = a.scoring(request)
      else:
          parser.print_help()
          exit(-1)
  
      save_result(result, args.output)
  
file_path: MONAILabel/monailabel/interfaces/utils/app.py
imports: import argparse
  import json
  import logging
  import os
  from typing import Any, Dict
  from monailabel.config import settings
  from monailabel.interfaces.exception import MONAILabelError, MONAILabelException
  from monailabel.utils.others.class_utils import get_class_of_subclass_from_file
label_desc: Use image node_id 4 for calling a global function with example usage: run_main() without return types