code: def run(
      params: Optional[dict] = None, run_sync: Optional[bool] = False
  ):
      instance: MONAILabelApp = app_instance()
      result = {}
      for model in instance.info()["trainers"]:
          request = {"model": model}
          if params and params.get(model):
              request.update(params[model])
          res, detail = AsyncTask.run(
              "train",
              request=request,
              params=params,
              force_sync=run_sync,
              enqueue=True,
          )
          result[model] = {"result": res, "detail": detail}
      return result
  
file_path: MONAILabel/monailabel/endpoints/train.py
imports: import logging
  from typing import Optional
  import torch
  from fastapi import APIRouter, Depends, HTTPException
  from monailabel.config import RBAC_ADMIN, RBAC_USER, settings
  from monailabel.endpoints.user.auth import RBAC, User
  from monailabel.interfaces.app import MONAILabelApp
  from monailabel.interfaces.utils.app import app_instance
  from monailabel.utils.async_tasks.task import AsyncTask
label_desc: Use image node_id 2 for calling a global function with example usage: run(params, run_sync) and returns: result