code: def parse_args(self, parser, argv, environ=None):
      environ = environ or os.environ
      args = parser.parse_args(argv)
  
      if (
          args.endpoint is not None and args.host is not None
      ):  # pragma: no cover
          raise ValueError(
              "Cannot specify host and endpoint at the same time"
          )
  
      if "MARS_TASK_DETAIL" in environ:
          task_detail = json.loads(environ["MARS_TASK_DETAIL"])
          task_type, task_index = (
              task_detail["task"]["type"],
              task_detail["task"]["index"],
          )
  
          args.host = (
              args.host or task_detail["cluster"][task_type][task_index]
          )
          args.supervisors = args.supervisors or ",".join(
              task_detail["cluster"]["supervisor"]
          )
  
      default_host = "0.0.0.0" if not _is_windows else "127.0.0.1"
      env_host = os.environ.get(
          "MARS_BIND_HOST",
          os.environ.get("MARS_CONTAINER_IP", default_host),
      )
      args.host = args.host or env_host
  
      args.ports = args.ports or os.environ.get("MARS_BIND_PORT")
      if args.ports is not None:
          self.ports = [int(p) for p in args.ports.split(",")]
  
      if args.endpoint is None and len(self.ports or []) == 1:
          args.endpoint = f"{args.host}:{self.ports[0]}"
          self.ports = None
  
      args.use_uvloop = args.use_uvloop or "auto"
  
      if args.config is not None:
          self.config = json.loads(args.config)
      else:
          if args.config_file is None:
              args.config_file = self.get_default_config_file()
          self.config = load_service_config_file(args.config_file)
  
      load_modules = []
      for mods in list(
          args.load_modules or ()
      ) + get_third_party_modules_from_config(
          self.config, self.node_role, environ
      ):
          load_modules.extend(mods.split(",") if mods else [])
      args.load_modules = tuple(load_modules)
  
      if args.supervisors is None:
          args.supervisors = ",".join(
              self._collect_supervisors_from_dir()
          )
  
      return args
  
imports: import argparse
  import asyncio
  import faulthandler
  import glob
  import importlib
  import json
  import logging.config
  import os
  import sys
  import tempfile
  from typing import List
  import psutil
  from ...utils import ensure_coverage
  from ..utils import load_service_config_file, get_third_party_modules_from_config
label_desc: Use image node_id 9 for calling the OscarCommandRunner obj's underlying member method code with example usage: obj.parse_args(parser, argv, environ) and returns: args