class_docstr: A class representing a Checkpoint instance of a trained model.
  
  A Checkpoint object is usually obtained from
  :func:`determined.experimental.client.get_checkpoint`. This class provides helper functionality
  for downloading checkpoints to local storage and loading checkpoints into memory.
  
  The :class:`~determined.experimental.client.Trial` class contains methods
  that return instances of this class.
  
  Attributes:
      session: HTTP request session.
      uuid: UUID of checkpoint in storage.
      task_id: (Mutable, Optional[str]) ID of associated task.
      allocation_id: (Mutable, Optional[str]) ID of associated allocation.
      report_time: (Mutable, Optional[str]) Timestamp checkpoint reported.
      resources: (Mutable, Optional[Dict]) Dictionary of file paths to file sizes in bytes of
          all files in the checkpoint.
      metadata: (Mutable, Optional[Dict]) User-defined metadata associated with the checkpoint.
      state: (Mutable, Optional[CheckpointState]) State of the checkpoint.
      training: (Mutable, Optional[CheckpointTrainingMetadata]) Training-related metadata for
          the checkpoint.
  
      Note:
          All attributes are cached by default.
  
          Some attributes are mutable and may be changed by methods that update these values,
          either automatically (eg. :meth:`add_metadata()`) or explicitly with :meth:`reload()`.
class_docstr_tok: ["A","class","representing","a","Checkpoint","instance","of","a","trained","model",".","A","Checkpoint","object","is","usually","obtained","from",":","func",":","`","determined.experimental.client.get_checkpoint","`",".","This","class","provides","helper","functionality","for","downloading","checkpoints","to","local","storage","and","loading","checkpoints","into","memory",".","The",":","class",":","`","~determined.experimental.client.Trial","`","class","contains","methods","that","return","instances","of","this","class",".","Attributes",":","session",":","HTTP","request","session",".","uuid",":","UUID","of","checkpoint","in","storage",".","task_id",":","(","Mutable",",","Optional","[","str","]",")","ID","of","associated","task",".","allocation_id",":","(","Mutable",",","Optional","[","str","]",")","ID","of","associated","allocation",".","report_time",":","(","Mutable",",","Optional","[","str","]",")","Timestamp","checkpoint","reported",".","resources",":","(","Mutable",",","Optional","[","Dict","]",")","Dictionary","of","file","paths","to","file","sizes","in","bytes","of","all","files","in","the","checkpoint",".","metadata",":","(","Mutable",",","Optional","[","Dict","]",")","User-defined","metadata","associated","with","the","checkpoint",".","state",":","(","Mutable",",","Optional","[","CheckpointState","]",")","State","of","the","checkpoint",".","training",":","(","Mutable",",","Optional","[","CheckpointTrainingMetadata","]",")","Training-related","metadata","for","the","checkpoint",".","Note",":","All","attributes","are","cached","by","default",".","Some","attributes","are","mutable","and","may","be","changed","by","methods","that","update","these","values",",","either","automatically","(","eg",".",":","meth",":","`","add_metadata","(",")","`",")","or","explicitly","with",":","meth",":","`","reload","(",")","`","."]
docstr: Downloads a checkpoint through the master.
  Arguments:
      sess (api.Session): a session for the download
      uuid (string): the uuid of the checkpoint to be downloaded
      local_ckpt_dir (Path-like): the local directory where the checkpoint is downloaded
docstr_tok: ["Downloads","a","checkpoint","through","the","master",".","Arguments",":","sess","(","api.Session",")",":","a","session","for","the","download","uuid","(","string",")",":","the","uuid","of","the","checkpoint","to","be","downloaded","local_ckpt_dir","(","Path-like",")",":","the","local","directory","where","the","checkpoint","is","downloaded"]
code: def _download_via_master(
      sess: api.Session, uuid: str, local_ckpt_dir: pathlib.Path
  ) -> None:
      """Downloads a checkpoint through the master.
      Arguments:
          sess (api.Session): a session for the download
          uuid (string): the uuid of the checkpoint to be downloaded
          local_ckpt_dir (Path-like): the local directory where the checkpoint is downloaded
      """
      local_ckpt_dir.mkdir(parents=True, exist_ok=True)
  
      resp = sess.get(
          f"/checkpoints/{uuid}",
          headers={"Accept": "application/gzip"},
          stream=True,
      )
      if not resp.ok:
          raise errors.ProxiedDownloadFailed(
              "unable to download checkpoint from master:",
              resp.status_code,
              resp.reason,
          )
      # gunzip and untar. tarfile.open can detect the compression algorithm
      with tarfile.open(fileobj=resp.raw) as tf:
          tf.extractall(local_ckpt_dir)
  
imports: import dataclasses
  import enum
  import json
  import logging
  import pathlib
  import shutil
  import sys
  import tarfile
  import warnings
  from typing import Any, Dict, Iterable, List, Optional
  from determined import errors
  from determined.common import api, constants, storage
  from determined.common.api import bindings
  from determined.common.experimental import metrics
  from determined.common.storage import shared
label_desc: Use image node_id 7 for calling the Checkpoint obj's underlying member method code with example usage: obj._download_via_master(sess, uuid, local_ckpt_dir) without return types