class_docstr: A launch project specification.
class_docstr_tok: ["A","launch","project","specification","."]
code: def __init__(
      self,
      uri: Optional[str],
      job: Optional[str],
      api: Api,
      launch_spec: Dict[str, Any],
      target_entity: str,
      target_project: str,
      name: Optional[str],
      docker_config: Dict[str, Any],
      git_info: Dict[str, str],
      overrides: Dict[str, Any],
      resource: str,
      resource_args: Dict[str, Any],
      run_id: Optional[str],
      sweep_id: Optional[str] = None,
  ):
      if uri is not None and utils.is_bare_wandb_uri(uri):
          uri = api.settings("base_url") + uri
          _logger.info(f"{LOG_PREFIX}Updating uri with base uri: {uri}")
      self.uri = uri
      self.job = job
      if job is not None:
          wandb.termlog(f"{LOG_PREFIX}Launching job: {job}")
      self._job_artifact: Optional[Artifact] = None
      self.api = api
      self.launch_spec = launch_spec
      self.target_entity = target_entity
      self.target_project = target_project.lower()
      self.name = name  # TODO: replace with run_id
      # the builder key can be passed in through the resource args
      # but these resource_args are then passed to the appropriate
      # runner, so we need to pop the builder key out
      resource_args_copy = deepcopy(resource_args)
      resource_args_build = resource_args_copy.get(resource, {}).pop(
          "builder", {}
      )
      self.resource = resource
      self.resource_args = resource_args_copy
      self.sweep_id = sweep_id
      self.author = launch_spec.get("author")
      self.python_version: Optional[str] = launch_spec.get(
          "python_version"
      )
      self.accelerator_base_image: Optional[
          str
      ] = resource_args_build.get("accelerator", {}).get(
          "base_image"
      ) or resource_args_build.get(
          "cuda", {}
      ).get(
          "base_image"
      )
      self._base_image: Optional[str] = launch_spec.get("base_image")
      self.docker_image: Optional[str] = docker_config.get(
          "docker_image"
      ) or launch_spec.get("image_uri")
      uid = RESOURCE_UID_MAP.get(resource, 1000)
      if self._base_image:
          uid = docker.get_image_uid(self._base_image)
          _logger.info(f"{LOG_PREFIX}Retrieved base image uid {uid}")
      self.docker_user_id: int = docker_config.get("user_id", uid)
      self.git_version: Optional[str] = git_info.get("version")
      self.git_repo: Optional[str] = git_info.get("repo")
      self.overrides = overrides
      self.override_args: List[str] = overrides.get("args", [])
      self.override_config: Dict[str, Any] = overrides.get(
          "run_config", {}
      )
      self.override_artifacts: Dict[str, Any] = overrides.get(
          "artifacts", {}
      )
      self.override_entrypoint: Optional[EntryPoint] = None
      self.override_dockerfile: Optional[str] = overrides.get(
          "dockerfile"
      )
      self.deps_type: Optional[str] = None
      self._runtime: Optional[str] = None
      self.run_id = run_id or generate_id()
      self._queue_name: Optional[str] = None
      self._queue_entity: Optional[str] = None
      self._run_queue_item_id: Optional[str] = None
      self._entry_point: Optional[
          EntryPoint
      ] = None  # todo: keep multiple entrypoint support?
  
      override_entrypoint = overrides.get("entry_point")
      if override_entrypoint:
          _logger.info("Adding override entry point")
          self.override_entrypoint = EntryPoint(
              name=self._get_entrypoint_file(override_entrypoint),
              command=override_entrypoint,
          )
  
      if overrides.get("sweep_id") is not None:
          _logger.info("Adding override sweep id")
          self.sweep_id = overrides["sweep_id"]
      if self.docker_image is not None:
          self.source = LaunchSource.DOCKER
          self.project_dir = None
      elif self.job is not None:
          self.source = LaunchSource.JOB
          self.project_dir = tempfile.mkdtemp()
      elif self.uri is not None and utils._is_wandb_uri(self.uri):
          _logger.info(f"URI {self.uri} indicates a wandb uri")
          self.source = LaunchSource.WANDB
          self.project_dir = tempfile.mkdtemp()
      elif self.uri is not None and utils._is_git_uri(self.uri):
          _logger.info(f"URI {self.uri} indicates a git uri")
          self.source = LaunchSource.GIT
          self.project_dir = tempfile.mkdtemp()
      elif self.uri is not None and "placeholder-" in self.uri:
          wandb.termlog(
              f"{LOG_PREFIX}Launch received placeholder URI, replacing with local path."
          )
          self.uri = os.getcwd()
          self.source = LaunchSource.LOCAL
          self.project_dir = self.uri
      else:
          _logger.info(f"URI {self.uri} indicates a local uri")
          # assume local
          if self.uri is not None and not os.path.exists(self.uri):
              raise LaunchError(
                  "Assumed URI supplied is a local path but path is not valid"
              )
          self.source = LaunchSource.LOCAL
          self.project_dir = self.uri
  
      self.aux_dir = tempfile.mkdtemp()
  
imports: import enum
  import json
  import logging
  import os
  import tempfile
  from copy import deepcopy
  from typing import TYPE_CHECKING, Any, Dict, List, Optional, cast
  import wandb
  import wandb.docker
  from wandb.apis.internal import Api
  from wandb.errors import CommError
  from wandb.sdk.launch import utils
  from wandb.sdk.lib.runid import generate_id
  from .errors import LaunchError
  from .utils import LOG_PREFIX, recursive_macro_sub
label_desc: Use image node_id 1 to create a new LaunchProject object  with example: obj = LaunchProject(uri, job, api, launch_spec, target_entity, target_project, name, docker_config, git_info, overrides, resource, resource_args, run_id, sweep_id)