class_docstr: Operations with runs
class_docstr_tok: ["Operations","with","runs"]
docstr: Submit a run
  
  Args:
      configuration (Union[Task, Service]): A run configuration.
      configuration_path: The path to the configuration file, relative to the root directory of the repo.
      repo (Union[LocalRepo, RemoteRepo, VirtualRepo]): A repo to mount to the run.
      backends: A list of allowed backend for provisioning.
      resources (Resources): The minimal required resources for provisioning.
      spot_policy: A spot policy for provisioning.
      retry_policy (RetryPolicy): A retry policy.
      max_duration: The max instance running duration in seconds.
      max_price: The max instance price in dollars per hour for provisioning.
      working_dir: A working directory relative to the repo root directory
      run_name: A desired name of the run. Must be unique in the project. If not specified, a random name is assigned.
      reserve_ports: Whether local ports should be reserved in advance.
  
  Returns:
      submitted run
code: def submit(
      self,
      configuration: AnyRunConfiguration,
      configuration_path: Optional[str] = None,
      repo: Optional[Repo] = None,
      backends: Optional[List[BackendType]] = None,
      resources: Optional[ProfileResources] = None,
      spot_policy: Optional[SpotPolicy] = None,
      retry_policy: Optional[ProfileRetryPolicy] = None,
      max_duration: Optional[Union[int, str]] = None,
      max_price: Optional[float] = None,
      working_dir: Optional[str] = None,
      run_name: Optional[str] = None,
      reserve_ports: bool = True,
  ) -> Run:
      """
      Submit a run
  
      Args:
          configuration (Union[Task, Service]): A run configuration.
          configuration_path: The path to the configuration file, relative to the root directory of the repo.
          repo (Union[LocalRepo, RemoteRepo, VirtualRepo]): A repo to mount to the run.
          backends: A list of allowed backend for provisioning.
          resources (Resources): The minimal required resources for provisioning.
          spot_policy: A spot policy for provisioning.
          retry_policy (RetryPolicy): A retry policy.
          max_duration: The max instance running duration in seconds.
          max_price: The max instance price in dollars per hour for provisioning.
          working_dir: A working directory relative to the repo root directory
          run_name: A desired name of the run. Must be unique in the project. If not specified, a random name is assigned.
          reserve_ports: Whether local ports should be reserved in advance.
  
      Returns:
          submitted run
      """
      if repo is None:
          repo = configuration.get_repo()
          if repo is None:
              raise ConfigurationError(
                  "Repo is required for this type of configuration"
              )
          # TODO: Add Git credentials to RemoteRepo and if they are set, pass them here to RepoCollection.init
          self._client.repos.init(repo)
  
      run_plan = self.get_plan(
          configuration=configuration,
          repo=repo,
          configuration_path=configuration_path,
          backends=backends,
          resources=resources,
          spot_policy=spot_policy,
          retry_policy=retry_policy,
          max_duration=max_duration,
          max_price=max_price,
          working_dir=working_dir,
          run_name=run_name,
      )
      return self.exec_plan(run_plan, repo, reserve_ports=reserve_ports)
  
imports: import base64
  import queue
  import tempfile
  import threading
  import time
  from abc import ABC
  from copy import copy
  from datetime import datetime
  from pathlib import Path
  from typing import Dict, Iterable, List, Optional, Union
  import requests
  from websocket import WebSocketApp
  import dstack.api
  from dstack._internal.core.errors import ConfigurationError
  from dstack._internal.core.models.backends.base import BackendType
  from dstack._internal.core.models.configurations import AnyRunConfiguration
  from dstack._internal.core.models.profiles import Profile, ProfileResources, ProfileRetryPolicy, SpotPolicy
  from dstack._internal.core.models.repos.base import Repo
  from dstack._internal.core.models.runs import JobSpec
  from dstack._internal.core.models.runs import JobStatus
  from dstack._internal.core.models.runs import Run
  from dstack._internal.core.models.runs import RunPlan, RunSpec
  from dstack._internal.core.services.logs import URLReplacer
  from dstack._internal.core.services.ssh.attach import SSHAttach
  from dstack._internal.core.services.ssh.ports import PortsLock
  from dstack._internal.server.schemas.logs import PollLogsRequest
  from dstack._internal.utils.logging import get_logger
  from dstack._internal.utils.path import PathLike, path_in_dir
  from dstack.api.server import APIClient
label_desc: Use image node_id 2 for calling the RunCollection obj's underlying member method code with example usage: obj.submit(configuration, configuration_path, repo, backends, resources, spot_policy, retry_policy, max_duration, max_price, working_dir, run_name, reserve_ports) and returns: self