code: def __init__(
      self, api: "Api", name, path: Optional[str] = None
  ) -> None:
      try:
          self._job_artifact = api.artifact(name, type="job")
      except CommError:
          raise CommError(f"Job artifact {name} not found")
      if path:
          self._fpath = path
          self._job_artifact.download(root=path)
      else:
          self._fpath = self._job_artifact.download()
      self._name = name
      self._api = api
      self._entity = api.default_entity
  
      with open(os.path.join(self._fpath, "wandb-job.json")) as f:
          self._job_info: Mapping[str, Any] = json.load(f)
      source_info = self._job_info.get("source", {})
      # only use notebook job if entrypoint not set and notebook is set
      self._notebook_job = source_info.get("notebook", False)
      self._entrypoint = source_info.get("entrypoint")
      self._args = source_info.get("args")
      self._partial = self._job_info.get("_partial", False)
      self._requirements_file = os.path.join(
          self._fpath, "requirements.frozen.txt"
      )
      self._input_types = TypeRegistry.type_from_dict(
          self._job_info.get("input_types")
      )
      self._output_types = TypeRegistry.type_from_dict(
          self._job_info.get("output_types")
      )
      if self._job_info.get("source_type") == "artifact":
          self._set_configure_launch_project(
              self._configure_launch_project_artifact
          )
      if self._job_info.get("source_type") == "repo":
          self._set_configure_launch_project(
              self._configure_launch_project_repo
          )
      if self._job_info.get("source_type") == "image":
          self._set_configure_launch_project(
              self._configure_launch_project_container
          )
  
imports: import json
  import os
  import shutil
  import sys
  import time
  from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional
  from wandb_gql import gql
  import wandb
  from wandb import util
  from wandb.apis import public
  from wandb.apis.normalize import normalize_exceptions
  from wandb.errors import CommError
  from wandb.sdk.artifacts.artifact_state import ArtifactState
  from wandb.sdk.data_types._dtypes import InvalidType, Type, TypeRegistry
  from wandb.sdk.launch.errors import LaunchError
  from wandb.sdk.launch.utils import LAUNCH_DEFAULT_PROJECT, _fetch_git_repo, apply_patch, convert_jupyter_notebook_to_script
label_desc: Use image node_id 1 to create a new Job object  with example: obj = Job(api, name, path)