code: def __init__(
      self,
      action: Literal["create", "resume", "view"],
      exp_id: str,
      config: ExperimentConfig,
      port: int,
      debug: bool,
      foreground: bool,
      url_prefix: str | None,
      tuner_command_channel: str | None,
  ):
      self.port = port
      self.experiment_id = exp_id
      self.action = action
      self.foreground = foreground
      self.url_prefix = url_prefix
      # config field name "experiment_working_directory" is a mistake
      # see "ts/nni_manager/common/globals/arguments.ts" for details
      self.experiments_directory = cast(
          str, config.experiment_working_directory
      )
      self.tuner_command_channel = tuner_command_channel
      self.python_interpreter = sys.executable
  
      if isinstance(config.training_service, list):
          self.mode = "hybrid"
      else:
          self.mode = config.training_service.platform
  
      self.log_level = cast(str, config.log_level)
      if debug and self.log_level not in ["debug", "trace"]:
          self.log_level = "debug"
  
imports: from __future__ import annotations
  import contextlib
  from dataclasses import dataclass, fields
  from datetime import datetime
  import logging
  import os.path
  from pathlib import Path
  import socket
  from subprocess import Popen
  import sys
  import time
  from typing import Any, TYPE_CHECKING, cast
  from typing_extensions import Literal
  from .config import ExperimentConfig
  from .None import rest
  from ..tools.nnictl.config_utils import Experiments, Config
  from ..tools.nnictl.nnictl_utils import update_experiment
label_desc: Use image node_id 1 to create a new NniManagerArgs object  with example: obj = NniManagerArgs(action, exp_id, config, port, debug, foreground, url_prefix, tuner_command_channel)